The podcast explores the history and adoption of Objective-C, comparing it to C++. It discusses the syntax and usage of Objective-C, highlighting its differences and foreign appearance. The importance of Objective-C in the Apple world is explored, along with its performance comparison to C/C++. The podcast ponders an alternative history where Objective-C could have rivaled C++.
Objective-C emerged by marrying Small Talk with the C programming language, gaining popularity through its adoption by Next Step and eventually becoming the main language in Apple's ecosystem.
Objective-C is a slim layer on top of C, allowing object-oriented programming with dynamic method resolution at runtime, while being integral to Apple's technology despite the emergence of Swift as a replacement language.
Deep dives
Development of Objective-C and its Connection to C and Object-Oriented Programming
Objective-C was developed in the early 1980s by Brad Cox and Tom Love. It emerged during a period of excitement around object-oriented programming, where the idea of breaking programs into reusable components gained popularity. Objective-C was created by marrying Small Talk, a prominent object-oriented programming language at the time, with the influential and widely-used C programming language. While C++ gained significant adoption, Objective-C initially had limited interest. However, when Steve Jobs started Next, the new computer company, they adopted Objective-C for their object-oriented operating system, Next Step. This became the niche for Objective-C, and eventually, Next Step evolved into Mac OS X and iOS, solidifying Objective-C as the main language in Apple's ecosystem.
Characteristics and Syntax of Objective-C
Objective-C is a slim layer on top of C, a strict superset where all C programs are valid Objective-C programs. It facilitates object-oriented programming in a different style compared to C++. In Objective-C, object-oriented programming is dynamic and resolves method calls at runtime, while C++ relies on static resolution at compile time. Despite its syntax being different and unfamiliar compared to other C family languages, Objective-C remains integral to Apple's technology, forming the foundations of Mac OS and iOS.
Current Usage and Performance Considerations
Objective-C is primarily used within the Apple ecosystem and is still prevalent in frameworks and app development despite the emergence of Swift as a replacement language. While Objective-C incurs a small performance overhead for pure object-oriented code, it is typically negligible for modern application developers. In cases where performance is critical, developers can easily drop down to the C level. Learning Objective-C is unnecessary for those who do not plan to work with older iOS and macOS code bases, as Swift has become the primary language for new app development. Nonetheless, Objective-C's elegant design and small syntax additions continue to be appreciated.
Objective-C was developed nearly contemporaneously with C++, yet it never achieved the same widespread level of industry acceptance. Both languages attempted to add object-oriented features to the C language, but they went about doing it in very different ways. Objective-C is a superset of C, marrying a thin object-oriented layer inspired by Smalltalk on top of the venerable C language. Today, Objective-C use is largely limited to Apple platforms where it is being replaced by Swift. In this episode we will explain the history of Objective-C and how it compares to C++.