Anyone who has any curiosity about Operating Systems at all should
really give BeOS a try. It has some wonderful features that really don't
exist in any other operating system, going to show that there is
plenty of room for improvement in the OS world today. Unfortunately,
however, you'll find that there isn't nearly enough mindshare, and
consequently not enough applications, drivers, or support to switch to
it full-time under most circumstances.
BeOS is based on a microkernel architecture, meaning that the kernel
only has the bare-bones services that must exist in kernel space. The
kernel provides a hardware abstraction layer and other basic services, but
most of the functionality is provides in the various servers which run in
user space. Sound, networking, and graphics services all are
implemented through the use of these servers, which allows them to be
stopped and restarted without rebooting! Also, if one of them crashes, it
doesn't take the system down with it: you just restart whatever server
crashed, and you're on your way.
Not that a reboot is so painful. BeOS boots extremely quickly, and
there's never time spent waiting for an fsck, thanks to the journaling
of BFS.
The next thing you notice as a user is how ridiculously responsive the
GUI is. X11 and Windows simply don't compare in this department. I run
it on a PII-300, 64 MB RAM, and GUI operations seem instantaneous.
Resizing windows, switching between virtual desktops, clicking on buttons,
it's all lightning fast, and doesn't slow down even if the computer's under
a heavy load. It's nice to be reminded that GUI's don't have to feel
clunky.
It looks good too. Really good. Fonts are anti-aliased, and look better
than any other GUI, easily. It supports alpha blending natively, so if you
drag an icon around, on top of other things, you see the background through
the icon. But like the rest of the GUI, it's all very fast.
While the GUI is wonderful, with BeOS you don't have to give up your
command line either! It ships with bash, gcc, grep, vi, perl and
friends, making old UNIX heads feel right at home. Though it doesn't come
with everything you'd expect from a UNIX commandline (awk, autoconf, and
others), you can download ports of most of the GNU tools to supplement the
ones that it comes with. And since BeOS includes a fairly complete layer of
POSIX compatibility, porting apps from UNIX is not too difficult.
Not only do you get a commandline, but also a very powerful scripting
engine for GUI applications called "hey." To demonstrate:
$ hey Tracker get Title of Window [0]
(
Tracker is the equivalent of the
Finder on
MacOS). Or maybe something
like:
$ hey StyledEdit set Frame of Window 0 to "BRect(107,76,607,476)"
As you can see,
hey is very powerful.
Programming for BeOS is an unparalleled delight. The API is a clean set of
C++ classes that work the way you expect them to. After programming on BeOS,
going back to MFC is excruciatingly painful. Just to demonstrate, the
"Hello world" app in BeOS looks like this:
//
// Hello World 2000
//
// Copyright 1998, Be Incorporated
//
// Written by: Eric Shepherd
//
#include <Application.h>
#include <Window.h>
#include <View.h>
//
// HelloView class
//
// This class defines the view in which the "Hello World"
// message will be drawn.
//
class HelloView : public BView {
public:
HelloView(BRect frame);
virtual void Draw(BRect updateRect);
};
//
// HelloView::HelloView
//
// Constructs the view we'll be drawing in.
// As you see, it doesn't do much.
//
HelloView::HelloView(BRect frame)
: BView(frame, "HelloView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW) {
}
//
// HelloView::Draw
//
// This function is called whenever our view
// needs to be redrawn. This happens only because
// we specified B_WILL_DRAW for the flags when
// we created the view (see the constructor).
//
// The updateRect is the rectangle that needs to be
// redrawn. We're ignoring it, but you can use it to
// speed up your refreshes for more complex programs.
//
void HelloView::Draw(BRect updateRect) {
MovePenTo(BPoint(20,75)); // Move pen
DrawString("Hello, world!");
}
//
// HelloWindow class
//
// This class defines the hello world window.
//
class HelloWindow : public BWindow {
public:
HelloWindow(BRect frame);
virtual bool QuitRequested();
};
//
// HelloWindow::HelloWindow
//
// Constructs the window we'll be drawing into.
//
HelloWindow::HelloWindow(BRect frame)
: BWindow(frame, "Hello World", B_TITLED_WINDOW,
B_NOT_RESIZABLE|B_NOT_ZOOMABLE) {
AddChild(new HelloView(Bounds()));
Show();
}
//
// HelloWindow::QuitRequested
//
// When the window is closed (either by the user clicking
// the close box or by some other means),
// this function is called. You can add code to this
// to give the user the opportunity to save their document,
// or perform other such activities.
//
// Here we just give permission to close the window.
//
bool HelloWindow::QuitRequested() {
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}
//
// HelloApp class
//
// This class, derived from BApplication, defines the
// Hello World application itself.
//
class HelloApp : public BApplication {
public:
HelloApp();
private:
HelloWindow *theWindow;
};
//
// HelloApp::HelloApp
//
// The constructor for the HelloApp class. This
// will create our window.
//
HelloApp::HelloApp()
: BApplication("application/x-vnd.Be-HelloWorld") {
BRect windowRect;
windowRect.Set(50,50,200,200);
theWindow = new HelloWindow(windowRect);
}
//
// main
//
// The main() function's only real job in a basic BeOS
// application is to create the BApplication object,
// run it, and delete it when it terminates.
//
void main(void) {
HelloApp *theApp; // Pointer to our application object
theApp = new(HelloApp);
theApp->Run();
delete theApp;
}
As you can see, there are no silly AFX_MESSAGE_MAPs, nor funny
typedefs--this is C++ at it's best.
BeOS 5 for Intel, their latest release, is available for free, for
non-commercial use. You can
download it from http://free.be.com--the entire OS, including many sample
applications and demos is 40 MB! All the development tools, available
for free as well, are another 20 MB. The OS download is actually an EXE that
installs a 500 MB file onto a Windows partition, which is nothing but an
image of a BFS file system. Then, in a procedure I don't really understand,
it somehow manages to boot BeOS completely natively (ie. not "under"
windows). However, once the OS is installed, you can use the included Disk
utility to create a real bona-fide BFS partition and install from the 500 MB
fake partition to the real partition. I know this can be done: I've done
it.
In my opinion, BeOS is the best desktop operating system out there.
While Linux and other Unices shine on the server side, BeOS excels on the
desktop in ways that UNIX can never really do if it is to maintain its
flexibility.
But I fear that without major vendor support, BeOS is doomed to parallel
the Amiga; superior as it is in some ways, it just doesn't have the
momentum to overcome the formidable barriers to entry in the OS
market.
Sources:
BeOS Bible: Scripting -
http://www.beosbible.com/bos/ch_scripting6.html
http://shell.2xtreme.net/~dirk/BeOS/workshops/lesson1.html