«

»

Jun 02

Swift – Apple’s newest programming language – A Contract Developer perspective

Well moments ago Apple announced Swift, their new programming / scripting language. Which enjoys a huge performance increase over Objective-C, and removes a few of the key points that new developers would struggle with. One major sticking point with Objective C was the verbosity, people thought it was way to hard to read. I personally like it, as it’s clear and easy to know what each class / method does.

But let’s take a sneak peak at what we’re dealing with here. Below is a simple overview of differences from a high level from Swift, Python, OBJ-C, and C/C++. I’ll try to keep this updated as I find other key differences.

Feature Swift Python Objective-C C/C++
Typing* Weak/Strong Typed Weak/Strong Typed Strong Typed Strong Typed
End of Line newline newline/tab semicolon semicolon
Code Grouping braces tabs braces braces

* Typing, what that means is declaring a variable. In Strong languages you say what the type is for the compiler. E.G. int x=5, float y=10.3, string s = “my string”. And they cannot change types dynamically. Weak languages you can just declare them as a variable, and the compiler will choose what they are, e.g. var x=5, var y=10.3, var s = “my string”. In python you can change the type of a variable within the program when weak typed, this to me was always a dangerous practice and is forbidden in C languages. (e.g. in python var x = 5, x = “my string” is valid)

Summary:

All in all, it looks cool. I am a big C based language fan, and this has the feel of a good hybrid scripting / c foundation. I hate the tab stylings of Python, and the dot naming in java-esque scripting languages. The biggest issue I’m going to have is no client will ever allow me to use this. And it’s long known there is no independent gold mine in the Apple stores, so it’ll be hard to justify doing a single platform app in this language, but it sure looks fun; and I’ll try anyway.