A Swift justification

A Swift justification Image

At Apple’s Worldwide Developer Conference (WWDC), a new programming language was announced. A programming language is a language that allows a developer to construct an application. With a language developers can communicate with the device hardware to get it to perform tasks for us, like getting the user’s location using GPS, or display things to the user. The language used for iOS development up to this point has been Objective-C.

Objective-C is an old language. Originally built in the 1980s, Objective-C is an extension of an even older language, C. Although Objective-C was groundbreaking for its time, it has aged significantly since it was first introduced. Apple has attempted to keep it up with the times by adding features from other modern languages. But such patchwork solutions can only take a language so far. At some point a clean slate is required. Swift is that clean slate.

The Swift programming language is a composite of ideas and concepts from other languages. It’s core foundations are safety, readability and conciseness. The increased safety involves enforcing rules that prevent errors and crashes. With better readability the code is easier to follow. This is particularly useful when a programmer has to look at somebody else’s code. Conciseness is closely related to readability. A language shouldn’t be too concise, as that can hurt readability, but it shouldn’t be overly verbose either. Swift attempts to find a good middle ground between the two. If the language is too concise, it becomes to difficult to understand what any particular statement is doing because it encapsulates a large amount of behaviour. Too verbose and the language becomes hard to follow.

One of Swift’s most important features at this stage in its life is its interoperability with Objective-C. Apple has written a large number of their frameworks (collections of code that developers use to help them build software) in Objective-C. Developers outside of Apple have also written frameworks to help each other write software as well, almost all of them written in Objective-C. It is critical that Swift work with these frameworks in order to allow developers to write the best software in the least amount of time.

Swift is a well designed language. Many of its smaller details are still in flux, and it is in fact still changing. But its core foundations are strong and it’s ready to use today by developers today.