My Good and Bad on the new language Swift from Apple

apple-swift-logoI am a tech geek, I love coding and I certainly love learning new languages. My first look at Swift is only through the eyes of reading the manual, yes, some people like reading novels I like reading manuals. I have yet to download and play around with it so this is a more of a blind analysis than a hands on review. So let’s start with what I really like about the language.

The Good

First off I have to say the language looks overall very impressive. A lot was taken from very popular languages and of course it’s loosely based on C – very loose in fact. It seems they took the best from C, Java, JavaScript, C#, Python, and of course Objective-C. Some key things I love about the language in list format:

  • Return functions from a function – this is awesome in my opinion and a must have in any language.
  • Class Extensions – I really like this idea, it is similar to subclassing but a smaller footprint.
  • Automatic type inference – the scripters are going to love this!
  • No semi colons – how cool is that? While my trained brain actually thinks this looks confusing, I love when languages don’t need line delimiters.
  • Dynamically assigned constants – The world as we know it has changed. I love the idea of dynamically assigning values to constants. But I have one beef – check out the bad.
  • No more @! – I always hated the @ stuff in Objective-C, I am glad its gone.
  • Default parameters – very nice, I have used this in almost any language that has supported it in the past.
  • Mutating Methods – combination of Generics and method overrides in a nice little package. Mix this with an enumeration and you get some pretty clean-looking code.

The Bad

  • Constant references to classes can have their properties modified. I really don’t understand this and maybe I just haven’t thought through it enough, maybe someone else has a brighter perspective. This goes against everything I have ever thought about “Constants”.
  •  Can be mixed with current Objective-C projects. While this is probably essential, I really don’t like this concept. For instance, when C++ came out we ended up with C++ people and C people all writing for the same code base. It meant supporting the two languages forever and we never really moved to “just C” or “just C++”. In my opinion, if you adopt Swift, have a plan to get rid of the old stuff.

To end, you can see I don’t have a lot of gripes with Swift today. I am an optimist when it comes to learning new languages and I usually find problems when compiling and deploying applications but it doesn’t sound like I will with this language. Many times the editor comes into play with the language, if you have an great IDE to support type ahead and code templates and samples it makes using the language more fun. I guess the next step is to actually start playing around!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.