The NeXTonian

Objective-C

To understand why Objective-C should make such a difference, to understand why Steve Jobs should go after this proprietary language, it is necessary to go back to the origins of object orientation and see how Objective-C and all the other OO products came about.

First on the field was Simula, a Scandinavian language. Its name implies 'simulations', ie the ability to simulate the real world through the description and implementation of objects.

The Xerox Palo Alto Smalltalk project borrowed from Simula, but rewrote the rules and made object orientation really work. The Smalltalk project was not a production model: their mouse was hardly ready for consumer use, being a hard box with sharp edges - not exactly the type of device that fits comfortably in the hand.

And their language Smalltalk, while effective, was not a production model either: it was interpretive rather than compiled, meaning it got the job done, but it could take considerable time.

The advantages of Smalltalk over Simula were very apparent; readying Smalltalk for the consumer world was a step Brad Cox would have to take.

As C is the fastest language ever, it was obvious the 'compiled' version of Smalltalk should be based on C. Brad Cox used the ability of C to work with a preprocessor to define his 'language' so that the output of a compile would result in C code - which in turn could be compiled as always. This gave the language the necessary speed.

Objective-C and NeXTSTEP have been intertwined from the beginning. NeXT additions to the language, the 175 classes of NeXTSTEP, all add to the power of the environment.

And like Smalltalk before it, NeXTSTEP was more than an operating system: it was also a development environment. Creating new programs with Objective-C, with the NeXTSTEP classes, and above all with Jean-Marie Hullot's Interface Builder, was fast and painless, while across town in the C++ camp people were pulling out their hair.

Objective-C sees the activities of the desktop as an interrelation between sovereign objects. These objects communicate at runtime. While other environments and languages such as Windows, C++, KDE and the like have 'messaging', it's not the same thing. Windows messages are just function calls; C++ code is always hard-baked at build time, with no flexibility for runtime contingencies. Linux desktops such as KDE, dependent as they are on C++, are equally handicapped.

If you're going to send messages, then send the messages; otherwise call them by their real name: function calls. But function calls, on a GUI desktop continually in flux, can get you into trouble. Things can happen which mean that seemingly innocuous code causes program crashes.

Other environments, with their function calls masquerading as messages, in practice grab hold of foreign objects and dictate what is going to happen; with Objective-C, objects get messages, and then are free to do whatever they please. It's not hard-baked into the executable; it's all done at runtime, and the receiver of the message has the final say.

Objective-C allows for dynamic typing and dynamic binding. The Apple menu bar is the best example: the same Edit submenu appears for all applications, no matter the context. You always have Undo, Redo, Cut, Copy, Paste, Delete, Select All, Find, Spelling, Speech. Who gets the messages generated by menu selections is not set; it's determined at runtime.

Using a so-called 'responder chain', the system can see if there is anyone ready to respond to these messages, and working from the focal point of the mouse and keyboard, the system finds the first best object to receive the message.

In a graphics program, if you select part of a picture and then choose Cut from the Edit submenu, you'll likely remove the selected part of your picture. If however you are saving your new image to disk and invoke the Cut command, whatever text is selected in your Save As dialog will disappear.

It is this dynamic binding which makes Objective-C and Apple OS X so powerful. Even if Objective-C were not a pleasure to use, it would be the obvious choice; that it's light years away from C++ only makes the prospects brighter.



About | Buy the Software | Forum | Industry Watch | Learning Curve | Newsletters | Products
Copyright © Rixstep. All rights reserved.