Apple's Swift Language

Well that was late and yet still unexpected.

I've been bashing Apple of late for calling Objective-C a modern programming language as it lacked numerous important modern code features like standard garbage collection. And this was destroying the user experience for me on Apple products. Even Apple's own products like the iTunes Store on my iPad would crash at random. It was completely unacceptable. They were leveraging a language and tools that even their own developers seemingly could not write a proper application in. And this was not a short term or isolate problem. I had this problem across the majority of apps on my iPad and most persisted for years (and probably thereafter, as I passed on my iPad to another a while ago). My wife had similar problems on her iPod Touch.

So, Apple releases a new programming language. Swift.

I'm torn on this topic. On the one hand I agree with the skeptics and critics and on the other, I understand why Apple chose this direction.

Firstly, the negative side of things. Adding a new programming language? Seems to be the fashionable thing of late. But it just complicates things. Even if it is syntactically similar to the existing languages there will be differences, and those differences will matter. There is also nothing revolutionary about the language itself from what of read (except maybe to those developers who have lived exclusively in the Apple development world). And, there is (technically) no reason why they couldn't opt for an existing language that leveraged all of those elements (there are however a few logical reasons, but that is coming up later in this post).

And I want to circle back to language similarities. This is a double-edged sword. While it means existing developers will look at it and feel more comfortable. It also means that they are less likely to unlearn the "old ways". And where the old and the new clash, there will be GREAT frustration. An obvious place to start; memory management. As in any language without garbage collection in an app of any relevant size this would have required a MASSIVE time investment. Entire libraries will need to be rewritten. Memory management code littered throughout files and classes will need to be removed or altered. And, when writing new code, tons of old habits will need to be forgotten or adapted.

So, in my opinion, there are actually a ton of reasons in favour of choosing an existing language that it totally different over writing a new and somewhat similar language.

The other concern I can agree with is the viability of any programming language effectively designed in secret. These aren't tools for Apple. The are tools for Apple and their 3rd party developers. To ensure you are delivering what your 3rd party developers need, you need to work with them. It is certainly possible that they pulled off the perfect implementation. It is just highly unlikely. And, done in this fashion is more likely to anger and alienate developers. Every flaw will be pounced on. And adoption rates will likely be hampered.

I know I'm crazy for even suggesting this. But I think Apple should have adopted C#/.Net. It is a much more mature language that contains all of the features Apple was aiming to add. With the Roslyn Project, they don't even need to compile to JIT compiled assembly if they don't want. And it would add new potentially developers to Apple's arsenal. In fact, it would be a move that might take MS loyalists away. Unveiling a totally new programming language simply alienates your existing pool of developers and will need a long runway before it is even widely accepted amongst your own development base. The other benefit of .Net is that some percentage of that base of 3rd party developers will already know .Net. None of them will already know Swift.

Now, all of that being said, I do understand the motivation. Firstly, the things Swift addresses are things which needed to be addressed. As I said, if Apple's own developers can't write stable code, how the hell do they expect 3rd parties to do so. And, they needed to do so (for brand and image reasons) in an approach which looked and felt holistically like an Apple approach. Unfortunately for Apple, that almost necessitates creating a totally new proprietary language.

While it is true that .Net may win out on a number of key elements in my mind, where it falls apart is brand and image. Even though Apple and MS have traditionally gotten along quite well, their fans never have. So, adopting a framework created by Microsoft might be seen as a betrayal to their base.

Another reason is control. Apple couldn't go with an existing solution from elsewhere because it would be much harder to enforce that developers pay Apple for the right to be an Apple developer. It would also be an indirect way of sanctioning people trading in their MacBooks for Windows tablets and laptops as development tools. Apple wants, and perhaps perceives themselves to need to be able to control and monetize everything that they think they can get away with.

In many ways, Apple's decision is the logical one for their business. It is just frustrating to see the wheel re-invented for no conceivable reason.

Comments

Popular Posts