Why Learn Swift

From Coder Merlin
Swift Logo

When you first become interested in learning how to code, it can be overwhelming as you learn how many languages are out there. This article alone will touch upon just a small portion of computer history, and in doing so, will provide background on a few coding languages. It can be difficult to feel secure in your choice of a first programming language. After a basic first Google search, one will see Python, Java, Ruby, and Swift as suggested languages. There really are no wrong choices when learning, as long as you are widening your scope of understanding, but this article will give some history and logic behind choosing Swift to add to your software tool belt.

Origins of Swift[edit]

Beginning with C[edit]

Example Car Class
The C Programming Language,2nd Edition

Like other technologies and inventions, a lot is owed to predecessors. In the world of computer science, many consider C to be one of the most powerful and important programming languages due to its influence since its inception in the 1970s and 80s.[1] As of November 2021, C still ranks #2 in the TIOBE index.[2] C is still widely used and relevant in day-to-day life--the MacOS kernel, Windows kernel, Android kernel, and Linux kernels are all written in mostly C. C is also the closest among modern day programming languages to machine language, while still being high-level enough to be relatively easy to learn.[3] Additionally, C's syntax and structs has directly influenced a number of popular higher-level programming languages, including C++, C#, Objective-C, Python, Java, Javascript, PHP, and others.[1] As a replacement of Objective-C, Swift can also trace its programmatic origins to C.

Bell Labs, Unix, & Objective-C[edit]

In the 1970s, the team at Bell Labs was seeking to create a new programming language to for the developing Unix operating system (OS).[4] One programmer, Ken Thompson, developed the language, B, based on BCPL, a now obsolete language. Dennis Ritchie, also part of Bell Labs, created C by adding structures to B, allowing Bell Labs to write the Unix OS.[1] The Unix kernel was written in C, and throughout the 1980s, C grew in popularity, as did the Unix operating system.[5]

In the 1980s Objective-C was developed as a superset of C--i.e. Objective-C contains all of C's features AND has additional syntax for classes and methods.[4] Objective-C was developed by Brad Cox and Tom Love in the 1980s. Intrigued by the ideas from Smalltalk, from Alan Kay's team at Xerox, where programming was data-centered, grouping information as "objects," and actions carried out on the objects would be called "methods." Additionally, Smalltalk programs could execute methods in real-time, and therefore could take user input. However, Cox and Love wanted to use a Unix system, and admired how quick and efficient C's programs could be. They developed Objective-C to combine the qualities they desired from both C and Smalltalk.

NeXT logo

NeXT, the predecessor to Apple, licensed Objective-C from Cox's and Love's company, Stepstone in the late 1980s, and bought the rights to Objective-C from Stepstone in 1996. Objective-C was further developed to meet NEXT's and then Apple's operating systems' needs. [6] Then, Apple launched Swift in 2014 to eventually replace Objective-C.[7]

What is Swift?[edit]

Apple logo black

Apple "Replaces" Objective-C[edit]

In 2010, Chris Lattner, a software engineer at Apple, began creating another programming language that would improve on and be able to integrate with Objective-C. In 2014 Apple introduced Swift as a syntactically smoother and safer option to eventually replace Objective-C, which was the primary language for developing Apple operating systems and its apps[4] When Lattner and Apple released Swift in June 2014, they also released Swift Playgrounds, an app that serves as an educational tool and development environment for Swift. Playgrounds allowed new users to explore Swift and allowed Apple to demonstrate how easy Swift was to pick up.[8]

A Safe, Fast, and Modern Programming Language[edit]

When looking at Apple's official page on Swift, the characteristics of the language most advertised come to the fore quickly. Apple describes Swift as "Modern...Designed for Safety...Fast and Powerful...Open Source" and easily adoptable for macOS and iOS development due to its ability to co-exist with Objective-C.[9] When explaining the modernity of Swift, Apple's page describes clean syntax, devoid of required characters that denote the end of lines, automatic memory management, and support of emojis and various foreign languages. With regard to safety, Apple adds that all variables are always initialized before they can be used.[9] Swift has been described as "a type-safe and memory-safe language."[10] This means that Swift was written and designed to prevent common bugs and memory problems from occurring, without the same level of vigilance required from the programmer when using C, Objective-C or other languages.[10]

Reasons to Learn Swift[edit]

Open-Source (& Apple) Community[edit]

Just like Linux, Swift is an open-source software. This means that, like other open-source technologies, there are a number of people--developers, product managers, companies, etc.--that are able to troubleshoot and resolve any issues or security breaches that may arise. Additionally, there is a community to help beginner coders, and new Swift users acclimate and kick-start their journey with Swift. Furthermore, having the backing of a major tech company like Apple is an added benefit as there is an existing community that already uses the language everyday.

Apple Infrastructure & Intentions[edit]

Since Swift originated at Apple, the language was designed at the same time as accompanying tools and apps, such as an integrated developer environment (IDE), debugger, and more.[8] Apple, on its official Swift page, also writes that Swift "was designed to be anyone’s first programming language," and links to free Swift curriculum created by Apple for educators, as well as a free student-friendly app designed to learn how to code, and how to code in Swift specifically.[9] The app, Swift Playgrounds, was released in 2014 at the same time that the language was first launched. Playgrounds, available on iPad and desktop, lets the user write code directly in the app, without needing to recompile or restart the program. The animations makes it accessible to students of all ages, and the goal-oriented nature of the app makes it engaging for adult users too. Playgrounds itself also illustrates how fast a language Swift is, outpacing Objective-C greatly.[8]

Professional Development[edit]

The ubiquity of the iPhone, iPad, and Apple's products creates an immediate incentive for companies to provide Apple-friendly mobile versions of any applications they run. This, in turn, creates the need for developers who can create mobile apps using Objective-C, and now using Swift as well.[8] Building an iPhone app can also be a great way to begin a portfolio as a student applying to colleges or internships.

Get Started Learning Swift[edit]

Coder Merlin is meant to provide accessible quality computer science education for students, primarily in high school. As such, starting students with a beginner-friendly, open-source programming language like Swift aligns with the mission and vision of the wiki. Much like the Linux OS that Coder Merlin uses, Swift provides students with access and practice in utilizing an entire community of technologists beyond Coder Merlin. Beyond the free resources mentioned in this article that are available through Apple, Coder Merlin will also provide additional, tailored support and curriculum to aid students in their journey through code. By learning with Coder Merlin, you are then gaining valuable hands-on experience with Swift, and can potentially even develop your own macOS and iOS apps based on your learnings. Whether Swift is your first, second, third, or nth language, happy learning and coding!

Key Concepts[edit]

KeyConceptsIcon.png
Key Concepts
  • What is Swift?
    • Swift is a modern language developed by Apple as an improvement to Objective-C, used mainly for iOS and macOS development.
    • Swift's predecessor Objective-C, was built in the 1980s as a way to integrate object-oriented programming syntax into C.
    • In turn, C was developed in the 70s in Bell Labs for the Unix operating system.
  • Reasons to learn Swift
    • Swift is significantly faster than its competitors.
    • Swift is open-source, and provides the support of an open-source community.
    • Having been developed by a tech giant, like Apple, Swift also benefits from infrastructure and support from Apple, throughout its development, including curriculum, and other educational resources.
    • Swift is used to develop iOS apps, therefore creating an opportunity for job skill and portfolio development.
  • How to get started learning Swift
    • There are many free resources made available through Apple's website.
    • Anyone with an iPad or Mac can download the Swift Playgrounds app, and get started coding Swift immediately.
    • Using Coder Merlin to learn Swift, Linux, and other software concepts is another free and easy way to kick-start coding.

References[edit]


CoderMerlin™ proudly recommends:
HintIcon.png

Your purchase via these links helps keep  Coder Merlin™ 's orbuculum ablaze. As an Amazon Associate we earn from qualifying purchases. Thank you for your support!


Designed with pride in Silicon Valley, CA, USA