Rhapsody Brain Dump
Volume Number: 13
Issue Number: 8
Column Tag: Rhapsody
Rhapsody Brain Dump
by Michael Rutman, independent consultant
What did Apple have to say about Rhapsody at WWDC??
Rhapsody at WWDC
Once a year, Apple hosts the World Wide Developer Conference. Developers from all
over the globe come to Cupertino to learn what Apple plans for the next year. In the
past, Apple wanted to show us their technologies as early as possible to get our
feedback as well as help us prepare our products for the new technologies.
Unfortunately, after the developer feedback and market realities have settled in, what
Apple showed doesn't always make it into the marketplace. This has left the developer
community a bit jaded towards Apple telling us about new technologies at WWDC.
This year, however, was different. Apple had only one main message, and that message
is Rhapsody. Last December, Apple purchased NeXT, put everything else on hold, and
has been working day and night to integrate their new technology with the existing
Macintosh OS that we have all come to love. The teams were merged in the first week of
February, so Apple was really only able to talk about what they have done in the last 3
months.
What did Apple have to show for only 3 months work? They showed a lot. They showed
Marathon running on a diskless Macintosh computers booted over a network. They
showed OPENSTEP with the start of a Macintosh look and feel. They talked about what
will continue to work and what will break, and for the most part, everything will
continue to work, as long as the software is not patching low level routines, or directly
messing with hardware.
However, Apple also projected a huge reality distortion field. Even though they had
been working on this for only 2 months, the level of excitement at Apple had people
believing. They showed things running, and developers, including me, were willing to
believe that anything's possible. You should remember that after WWDC developers
sometimes don't think as clearly as they should.
Rhapsody Technical Overview
Rhapsody is the mature NEXTSTEP foundation -- Mach, OPENSTEP, BSD UNIX, and
Distribute Objects -- mixed with the industry leading Apple technology: QuickTime
Media Layer, ColorSync, and AppleScript. Rhapsody will also include other cutting edge
technologies, such as EOF, WebObjects, and Java. Rhapsody is still developing, so more
technologies probably will be added over the next year.
How does Apple plan on putting all this together? Figure 1 shows the Apple Roadmap to
Rhapsody, but what does it mean? The bottom box represents the hardware. That
currently can be either PPC or Intel chips. For the vast majority of programmers, the
hardware chip is completely irrelevant because the Core OS layer above the hardware
entirely covers the hardware.
Figure 1. The Apple Roadmap to Rhapsody from the DevWorld web site.
Core OS
The Core OS layer consists of Mach, a BSD Implementation, and a plugin driver
architecture. Mach is often confused with unix, but in reality is a micro-kernel. The
Mach code consists of a mere 35 thousand lines of code out of over 6 million lines in
Rhapsody. The Mach micro-kernel controls the Virtual Memory, Tasks, Threads,
multiple processors, and inter-application communication.
The BSD implementation is a fully compliant unix with Posix extensions. However,
many Macintosh users have come to fear and loath unix. Well, maybe not fear and
loath, but few Macintosh users embrace unix, and don't want to learn unix tools to get
their jobs done. Fortunately, Apple recognizes this and has hidden the unix layer near
the bottom. Most users will never see the unix layer, and better yet, most developers
can ignore the unix layer. Best of all, if you like unix, it's there and is accessible.
The plugin driver architecture was created because of OPENSTEP for Intel. In the Intel
market, NeXT had to be able to create new drivers quickly. Every month, there were
new drivers to port, and few of the hardware manufacturers would standardize. The
Rhapsody team is working very hard on this. In addition, because this is a Mac,
Rhapsody is also promising true plug-and-play.
For most people, users and developers, the entire Core OS is hidden behind the next
layer, which is either the Blue box or the Yellow Box.
What is the Blue Box
Neither Apple, nor the developers, are prepared to abandon the thousands of
applications already created. Many of these are legacy applications, which will
continue to be used for many years. Apple is creating what they call a compatability
layer, code named, "Blue Box".
The compatability layer consists of the MacOS, the Finder, ToolBox, extensions,
whatever currently runs on your Macintosh. Apple plan to take all of this code, and
turn it into an OPENSTEP application. This application, running under Rhapsody, will
run almost all existing Macintosh Software.
How can Apple do this? Isn't there a huge difference between an OS and an application?
Actually, there isn't. Both are written the same way, both are launched the same way,
and both can do the same things. An OS is used to launch other applications, but many
applications also do this with a plug-in architecture. There is very little difference
between how Netscape uses helper applications and an OS launching an Application.
Apple is planning on presenting users with 3 ways of running the Blue Box: a single
window for all Blue apps, Blue apps using all of the screens, and dual boot. As each
user's needs are different, Apple is looking at a variety of solutions to best serve their
users.
The single window mode is best for those users that quickly migrate to Rhapsody, but
want to continue running a few older applications. These older applications, called Blue
Apps, all appear in a single Rhapsody window with the Blue Box menu bar. If two Blue
Apps are running, their windows appear in the same Blue Box window. Rhapsody
applications continue to look and act like normal Macintosh applications.
The second mode, where the Blue Box takes over the screen, looks like a traditional
MacOS 8 machine, but has Rhapsody running in the background. Rhapsody applications
are not able to interact directly with the user, but background processes continue to
provide services. A user is able to quickly switch between these two modes.
The last mode is a dual boot mode. No matter how hard Apple tries, some applications
just aren't going to work in a compatability mode. Some developers have programmed
directly to the hardware, and their applications expect there to be hardware, not a
compatability layer. Despite there being very few of these applications, some users
will want to continue using them. To allow these users to have access to Rhapsody and
MacOS, Apple has a dual boot mode. At boot time, users can choose to boot into Rhapsody
and run the Blue Box, or they can choose to boot straight into MacOS 8. With a reboot,
users will be able to run their incompatable applications, then reboot back to
Rhapsody as they need.
What is the Yellow Box?
The Yellow Box has two parts, the Java VM and OPENSTEP. The Java VM has been talked
about in just about every trade magazine for the last year, but OPENSTEP, despite
being around for almost a decade, is still relatively new to most Macintosh
programmers.
Apple's Java VM is still being defined, but so is the Java language. Apple has fallen
behind on the Java curve, but is working to catch up. Apple is promising JDK 1.1 for
the Java VM, full implementation of AWT, and 100% pure Java libraries. Apple is also
providing the cross-platform, web oriented Java capabilities, and Apple is looking to
integrate Java into the system as tightly as any other language. Java under Rhapsody
can run QuickTime3D, send Apple events, use native code... whatever.
OPENSTEP is the main part of the Yellow Box. OPENSTEP is based on NEXTSTEP. It has
existed in one form or another for almost a decade, but in the last 3 years, NeXT has
fleshed it out with Sun and HP to provide a full-featured framework for developing
applications.
OPENSTEP, from NeXT, was a second generation object oriented framework.
Originally, NeXT provided developers with, most people will agree, the most powerful
framework for developing applications ever seen. Study after study showed how
development under OPENSTEP would go 3 to 10 times as fast as under either Macintosh
or Windows. NeXT, however, felt that it wasn't good enough, and they sat down and
redid it.
They took everything that developers liked, and expanded them. They then fixed most of
the problems developers had been complaining about for years. They then addressed the
issues developers were going to have in the future, but hadn't gotten around to yet.
Now, Apple owns it, and is adding more technology to make it even better.
Even though this sounds like a lot of marketing speak, Apple was prepared to show off
their power. They started with a demo where a marketing person made a version of
SimpleText without writing a single line of code. They then had engineers come up and
talk about how to implement various technologies. If there was one unifying theme, it
was simplicity and rapid development.
Is the Yellow Box just OPENSTEP?
Even without OPENSTEP's rich environment, Apple has led the market in certain
areas. Apple is the leader in QuickTime, and their scripting environment is second to
none. Furthermore, Apple defined ease-of-use, and while NEXTSTEP is the easiest to
use unix, nothing is as pleasant as the Macintosh user's experience.
Apple has already ported the QuickTime Media Layer, ColorSync, GX Typography, and
V-Twin to the Yellow Box. Apple is also creating more widgets, such as the TabView and
OutlineView. The OutlineView is the Finder View, and by making this public,
developers will be able to make their applications look and feel more like the Finder,
and each other.
Apple is also working on porting AppleScript by integrated it into the frameworks. As
any application developer will tell you, implementing a full-featured AppleScript
environment can be as much work as all other features combined. While that's an
exaggeration for most applications, it's still very difficult. By putting AppleScript
into the framework, the hope is to make supporting AppleScript as easy as anything
else under OPENSTEP.
What's in OPENSTEP
OPENSTEP is made up of a number of different kits. The original kit -- the AppKit --
handles all UI features such as windows, views, menus, and controls. The AppKit has
been expanded and revamped over the years to provide more features and to be easier
to use.
NeXT also created a MusicKit to help developers create music applications with full
support for MIDI and score files. Unfortunately, very few applications based on the
MusicKit were ever created, and NeXT eventually unbundled the source and released it,
with full sources, on the Internet.
Later, NeXT realized that connecting to databases was both important and hard. Every
database has a different API, and each version of each database is slightly different.
Furthermore, every database API is hard to use. NeXT's first attempt was the dbKit.
The dbKit wrapped an object oriented framework around any database. A retrieval
returned a list of objects containing the data requested. Complex searches and joins
were, likewise, done through an object-oriented approach.
Unfortunately, NEXTSTEP, at the time, was not powerful enough, and dbKit had serious
design flaws. NeXT responded by dropping dbKit, creating a more powerful framework
called the FoundationKit, and re-writing the database kit as the Enterprise Objects
Framework (EOF). Even though EOF has a different API, and is more powerful, the
basic concepts behind it are the same as in dbKit.
The FoundationKit dealt with two major difficiencies in the original NEXTSTEP,
garbage collection and the ability to encapsulate arbitrary data in objects.
Automatic garbage collection was needed to manage the deallocation of objects returned
by functions. Each time an object was returned, there was always the question of which
object is responsible for freeing it. If the receiver didn't free it when it was supposed
to, memory leaked. If the receiver freed it when it wasn't supposed to, the second free
method would cause a crash. dbKit passed a large number of objects through its layers,
and at each layer, there was potential for leaking. Automatic garbage collection handles
this problem by letting objects hold and release objects, then freeing them at the next
iteration of the event loop.
Objects that encapsulate data are important as databases return numbers and strings.
Dealing with the return values as either strings or data can lead to confusion. The same
call can return a string one time, a number the next time, and a list of strings and
numbers the third time. Worse, memory allocation for the storage has to be freed, and
the arbitration of memory freeing is a nightmare.
NeXT dealt with this by creating a data object. Any number or string can be placed
inside an NSData object. Automatic conversions between types allow programmers to
abstract the return type and deal with the data as needed. Furthermore, the garbage
collection handles memory allocaion and freeing.
The User Interface Layer
Apple has evaluated user experiences with the Macintosh, and has found that diversity
is good. Some users want a "modern" look with 3D graphics and soft grey-scales,
others want a colorful experience, and some users with site imparements need a black
and white, high-contrast environment. Apple is giving us the Appearance Manager so
all users will be satisfied.
In theory, the Appearance Manager allows a user to specify how they want their
applications to look, and all applications written correctly (and the vast majority are)
will adopt the specified look. Currently, Apple supports only one appearance, and that
one is the "modern" look, but Apple promises to help third party developers create as
many appearances as they want.
No matter what the appearance, though, and no mater what system is being run (Java,