Monday, August 3, 2015

Objective-C: Bringing Object-Orientation to the C Programming Language


 Today is the second part of our three-part series examining the history of the key programming languages and technologies that underpin application development on the iOS platform.

In our previous post, we looked atthe history of the C Programming Language from its inception in the AT&T Bell Labs through to its current standardization by the International Standards Organization as C11. In today’s post, we’ll look at Objective-C, the primary programming language used to develop iOS applications. We’ll see how a group of researchers in Xerox Palo Alto Research Centre took a fundamentally different approach to tackling the problem of programming a computer and how that approach, combined with the C Programming Language, resulted in modern-day Objective-C.

A Different Approach

At around the same time that the developers at the AT&T Bell Labs were developing the C Programming Language a second set of researchers including Alan Kay and Dan Ingalls were working away at the Xerox Palo Alto Research Center (PARC).  The focus of their research: Messaging.
Instead of taking the approach that first Thompson and then Ritchie had taken with the B and C programming languages (see our previous post), where the computer was fed a sequential set of instructions, Kay and Ingalls were focused on a different way of programming a computer based around the idea of objects, things that could send and receive messages and could collaborate and cooperate to achieve a particular task. This was a fundamentally different paradigm to how the AT&T team were tackling programming a computer and resulted in the first embryonic versions of a programming language called Smalltalk.
Through the 1970’s Smalltalk evolved within PARC with Kay and Ingalls refining the ideas of objects and messages until finally, in 1980, Smalltalk-80 was released to a select group of firms (including Hewlett-Packard, ITT Corporation, Apple Computer, Tektronix and Dec) and Universities (including UC Berkeley).  In doing so, Smalltalk-80, came into being and was the first in a new generation of ‘object-oriented’ programming languages that would soon rise in popularity.

The Blending of Two Ideas

At around that time two engineers, Brad Cox and Tom Love, were working for the ITT Corporation’s Programming Technology Center.  Both were exposed to the early versions of Smalltalk.  Cox became intrigued and quickly realized that benefit that a language like Smalltalk could bring.  Beyond this, he and Love also realized the need to for a language that was backwards compatible with C, a language that, in the 10 years since it’s inception had become critically important for the Telecommunications Engineering that his employer, ITT Corporation, undertook.  With this in mind, Cox set about writing a pre-processor for C, a program that would process source code in one format and convert it into a format that could be fed into the C Programming Language tool-chain.  This pre-processor allowed him to add some of the key features from Smalltalk to his source code and yet still have access to the power of the C compiler by having his pre-processor turn is doctored source code into standard C.  The result was what he called an Object-Oriented Pre-Compiler (OOPC) for C.
In the early 1980’s, Cox and Love left ITT Corporation to pursue further development of their Object-Oriented Pre-Compiler for C and formed Productivity Products International (which eventually became StepStone).  Together they focused on commercializing their new product as well as developing a supporting set of class libraries to further increase its flexibility.  This work eventually culminated in the publication of the book Object-Oriented Programming: An Evolutionary Approach in 1986, where Cox, along with co-author Andrew Novobilski, published the first full description of the Objective-C Programming Language.

Summary

In this post we’ve seen how taking a fundamentally different approach to tackling the problem of programming a computer gave birth to a whole new family of ‘object-oriented’ programming languages.  We’ve also seen how by creating Objective-C and combining the ideas from first object-oriented languages with the power and syntax of the C Programming Language, Brad Cox and Tom Love were able to leverage the benefits of both worlds.  In the next post, we will see how from these humble beginnings, Objective-C has taken a meteoric rise in popularity, has played a central role in Apples rise to become one of the largest companies in the world and see how its backwards compatibility with C and object-oriented features have positioned it as the key language you will need to learn before developing applications for iOS devices.


No comments:

Post a Comment