(C) 1998 Andrew C. Stone. All rights reserved.

    The arrival of Rhapsody Developer Release 2 has brought all sorts of new goodies and better object abstractions for the Yellow Box Developer, making our jobs as software artist-engineers that much easier.
    
    Probably the most noticeable is the advent of Java everywhere - TextEdit and other apps are written entirely in Java. Apple provides the "glue" so you can use Java to call almost any method in the Yellow Box API. This makes the YB that much more attractive to mainstream programmers, because people tend to flinch when you tell them they need to learn "yet another language".
    
    Of course, the secret of Objective C is that it exactly like C, except it adds two simple constructs: message passing and method definitions. A simple ObjC message looks like:
    
    [Bob goGetSomeCoffee];    
    
    Bob is the target of the message "goGetSomeCoffee". The beauty of OO programming is that if Bob's tastes have grown so he won't drink the soupy swill many places pass as Cafe, he can go get a latte without you changing your code. In the Bob class, you'd find a method definition like this:

- (void) goGetSomeCoffee
{
if ([Espresso isAvailable] && [halfAndHalf notEmpty])
    [self drinkLatte];
else
    [self drinkWater];
}

Underneath, the Objective C runtime is doing all sorts of magick that enables programmers to think in broad, abstract and reusable terms. I have heard it said that the biggest flaw in C++ is that it permitted old-style "Functional" programmers to migrate to the Object world, with all of their bad habits intact!

Well even old timer NeXTStep programmers can get bad habits - the Yellow Box has grown to encompass much of the functionality that we use to have to provide ourselves. I highly recommend reading and understanding Mike Ferris's Draw2 example (/System/Developer/Examples/AppKit/Draw2/), as it shows how to design your software using the new "Document Based Application" project type in Project Builder.

By adopting the Model-View-Controller pattern, you totally decouple the document's ownership of the data and how you display that data (which, in Mike's example automatically allows for simultaneous display of data in various different views). The other motivations for moving to the NSDocument and NSWindowController model include Undo/Redo for free, it will work on Mac OS X, it minimizes the amount of code you have to write, and you'll get scriptability for free when Rhapsody 1.0 ships.

More excellent reading along the lines of good architecture and the composite design pattern is by Don Yacktman, one of the pillars of the Yellow Box community and founder of the MiscKit. Read his analysis of a
better way to do rendering in Draw. Don's MiscKit effort is something I encourage all of us to contribute to. Unlike the Gnu Public License and other public domain license strategies, the MiscKit allows you to freely incorporate its objects into your commercial software. I just submitted a TableView subclass which adds the ability for users to reorder rows in a TableView.
    
The results of using the MVC pattern are quickly evident: it only took me a day to design and write the beginnings of new web tool using the new document architecture. The process of learning and refining our object design skills continues with the excellent Rhapsody Developer Release 2.