SBP Blog

Swift: reinventing the wheel (Part 1)

Jan 23, 2015 by AdrianC

Apple has been using Objective-C as their main programming language for many years, but the company from Cupertino decided that it’s high time they underwent some "swift" changes in the way iOS and OS X developers are building apps for Apple’s operating systems. As a result, at the 2014 Worldwide Developers Conference, Apple has introduced a new programming language: Swift, which had been under development since 2010.

Introducing Swift

Swift is a multi-paradigm programming language, purposely developed by Apple for the iOS and OS X operating systems. The main thing that can be said about Swift is that it's a remaking of the Objective-C language, using modern concepts and syntax, a remaking that promises an improved speed and security.

Described as an Objective-C without the C, Swift promises to keep the good parts and throw the bad ones, while adding what was missing in Objective-C. This resulted in more enhancements and also new features, such as:

• Automatic Reference Counting, which is a memory management mechanism somewhat similar to garbage collection (it will automatically remove unneeded information that’s sitting in the device's memory)
• Debugging enhancements such as a read–eval–print loop. Developers can view the results of a piece of code (as they type it) in the interactive playground
• Other things that make programming a bit easier and more powerful, such as strong typing and generics
• Swift is easy to use and learn, new developers won’t have a problem learning, old developers will quickly adapt

What about Objective-C?

After announcing the Swift programming language, developers have asked themselves: what about Objective-C? (the programming language that Apple has been using since the 80s). Well, the following weaknesses might be some of the reasons why Apple has decided to make a swift escape from Objective-C:

•  The pointers mechanism inherited from C makes it harder to have good guarantees about references, and this can lead to negative consequences in terms of performance and security
•  It requires manual memory management, which can result in stability problems (if not done well)
•  Objective-C does not have a facility for JIT (just-in time) compilation
•  It has no operator overloading.

Don't get me wrong, Objective-C is a capable programming language, but it does not seem to have the ability to keep pace with new features from other programming languages. In short, it's getting old.

In the second part of the article I will get to a more in-depth view of Swift. Until then, tell me, what is your opinion regarding Apple’s intent to develop a new programming language?

Update: Part 2 is here!

Tags: Programming 


No comments yet.

Your Comment: