IT IS A SOFTWARE PROGRAM THIS IS HOW IT WORKS---READ CAREFULLY
Bonobo is the component object model of the GNOME (Gnu Network Object Model Environments) project (it is also a monkey -- see Resources). Bonobo provides a COM-like model, using CORBA as a location-transparent transport. It is the foundation of the GNOME vision to provide a fully Free Gnu Network Object Model Environment.
In this series of three articles, we'll examine Bonobo in more detail: This article gives an overview of what Bonobo can do for you and how it works; the second article will focus specifically on the client side and cover how to use components others have written; and the final article of the series will discuss how to write your own components.
If you are new to components
Large-scale software is hard to write in a monolithic fashion. Inevitably, designs are broken into subparts and layers to make the software more manageable and tractable to parallel-team development and debugging. Also inevitably, however, there are problems at the interfaces: Often the interfaces are not well specified, and often they are subject to change. Another problem is that large applications tend to be split into modules that require hard build-time linkage together, whether as separate source modules or as libraries. Furthermore, large pieces of software have often evolved into huge unwieldy beasts that become impossible to maintain or extend.
Component software is one solution to this traditional problem. Component software is not monolithic in the least; on the contrary, it is minimalist. In Bonobo we use the OMG's IDL (Interface Definition Language) to codify the contract between components, providing an easy-to-understand overview of a component's external obligations. Bonobo also allows out-of-process components. This means that a huge piece of software can be pulled in as a component or automated without any nightmarish symbol mismatches. At the same time, it allows many bugs in a complex multi-component system to be easily isolated to a certain component. Similarly, this out-of-processes operation makes the stability of a multi-component system a constant: that of the container, rather than scaling linearly with the number of components (assuming that the container can sensibly handle subcomponent failure).
If you are new to Free Software
One of the more interesting aspects of the Free Software movement -- and one which is often overlooked -- is that it was founded back in 1984. Free Software (with a capital F), and specifically software published under the GNU General Public License (also known as the GNU GPL) allows any user of that software to copy, disseminate, and even alter (and redistribute the altered version of) the computer program in question. Which is why it is called Free -- to describe this freedom for the user from the constraints of what are often increasingly stringent controls over what users are allowed (or, in the case of most licenses, what they are not allowed) to do with their software.
Some software licenses today go to such extremes that if you donate an old computer to a local school without wiping off all of the software including the operating system, you are a "pirate" (even if you don't keep any copies of the old software yourself, and even if no money changes hands).
When you contrast this kind of rigid control over what users may do with software with the GNU license which guarantees a user's right to manipulate, copy and share software -- you start to see why Free Software is often such a heated issue.
And while today it is easy to see how directly the GNU GPL is at odds with restrictive licensing, and to see in the trade press how restrictive some licensing has become, this all was far from obvious back in 1984, when the Free Software Foundation was founded.
See Resources for more on Free Software and licensing.
Using Bonobo also solves one of the tricky problems in Free Software that is also one of its strengths: diversity. Often in the Free world (and in the non-Free world as well, for that matter), people cease maintaining projects due to time pressure, and replacements are rewritten from scratch. Or again, competing projects, such as CD player applications, arise. Allowing these applications to share the same Bonobo interfaces makes it easy to provide functional replacements, and tracing the entry points allows you to better understand an old application.
Finally, CORBA provides language independence. By specifying the interfaces in a neutral language like IDL (which is like C++), we can provide standard bindings to innumerable scripting languages.
CORBA and the ORB
Whilst terms like CORBA and an 'ORB' sound complicated -- indeed much of OMG world is littered with confusing, and forgettable acronyms -- these concepts are extremely simple. An ORB is an Object Request Broker. It is also, simply, a shared library. Whilst an ORB has a large and powerful API (Application Programming Interface), in real-life users seldom use ORB functionality directly, and with Bonobo even more of the ORB is hidden from view.
The most useful part of the ORB is typically invoked from the stubs and skeletons that are compiled by the ORB's IDL compiler. The user thus uses the ORB via the generated stubs and skels, using method names and conventions specified by the Object Management Group (or OMG), which specifies CORBA, among other things. So while it is useful to understand what an ORB does, it is best to model it as a black box, which handles method invocation on (possibly) remote objects.
When the GNOME project started using CORBA, we soon realized that all the current Free implementations were either too resource intensive, too slow, or did not implement the C bindings we desired. We wrote a new ORB called ORBit to solve this problem. This combines a fairly CORBA (2.2) -compliant ORB with some other desirable features. First, since the GNOME vision requires adding CORBA interfaces to all system functionality, its footprint must be small. Second, since it is a core component of the system, speed is of the essence. (The latter is much helped by a fast in-proc mode, where trusted components can share the same address space, which reduces the cost of an invocation to little more than that of a C++ virtual method.)
The OMG's CORBA standard was chosen since it was a public standard, it was already implemented by a number of Free ORBs, it was well specified, and it was not tied to any particular manufacturer. The C language was chosen for its superior portability, and its ability to interface nicely to multiple language bindings (as we learned from our experience with it in the Gtk+ project).
There are important limitations to our use of CORBA in Bonobo. For instance, we do not use multiple inheritance as in CORBA. Instead, we use interface aggregation via a COM-like Unknown interface (which we'll talk about later). Similarly, we discourage using the more esoteric features of the ORB. These limitations leave room for even simpler, lighter ORB-like implementations in future.
How Oaf helps
While CORBA is ideal for distributed programming, there is always the problem of getting the object name service reference (this is analogous to problems in finding the first DNS). Initially, since GNOME provided a desktop environment, we registered the name service on the X root window, thus allowing any GUI program to find the name service. While this was an easy solution, it tied GNOME to a single X session. The Object Activation Framework (Oaf), which allows an amazing wealth of activation possibilities, was written to overcome this. In addition to activation by a unique ID, it provides a SQL-like query language to allow capability-based activation.
Capability-based activation appears to map to the needs of component programming far more closely than any other approach. Oaf allows arbitrary fields and lists of fields to be associated with a component via an XML description file. For instance, this allows us to use a single command to "find an object that can handle a certain MIME type, implement certain named interfaces, be edited and render a certain version of HTML." Again, this capability is exposed via the SQL-like query language.
Each component is named by using a structured namespace, which is shared for interface allocation, and Oaf file naming. The name is a free-form string allowing for augmentation with a 128-bit random number to placate uniqueness paranoiacs.
What Bonobo is
There are several helpful orthogonal ways of looking at what Bonobo provides, namely there are three distinct functions:
Interfaces
Interfaces define Bonobo. They are specified in standard CORBA IDL, and they are independent of language, system libraries and platform.
Wrappers
Wrappers define C 'sugar' interfaces, which ease some of the issues of using CORBA from C, especially as concerns integration with Gtk+ (the GNOME widget system).
Implementation
Implementation is the guts behind the interfaces. Implementation provides the functionality that can be invoked via the CORBA layer. While it is possible to implement the Bonobo interfaces in any language, the GNOME implementation is sufficient and Free.
Another way of looking at Bonobo is that it assists in the implementation of:
Controls
Controls provide basic visual embedding. They are used to provide single view "rich widgets," customizable via property interfaces (much like an Active X control or JavaBean).
Components
Components have an implicit document/view abstraction, and are suitable for embedding in productivity applications.
Compound Document Support
Compound Document Support assists in the management of compound documents. Many supporting interfaces are provided such as structured storage, printing and monikers for linking.
The scope of Bonobo and CORBA is, however, not limited to such clearly desktop-oriented functionality. We want to provide easy-to-use CORBA interfaces for every system service. This would provide useful interfaces for services such as mail, printing, debugging, system devices -- free from the bane of forking, pipes, and ioctls.
Conclusion
That about does it for the overview of Bonobo. To recap, here are a few key points to take from this introduction:
There are real problems of parallel development and interoperability in today's Free Software world. Bonobo provides a Free solution to many of these issues.
A growing number of applications are available as Bonobo components, allowing their reuse in other applications. In addition to the obvious code-reuse advantages, this has nice UI-consistency advantages.
Component programming makes complex software development and use both tractable and intuitive. It also results in more maintainable and comprehensible software.
In the next article, we'll look at how to use some of the Bonobo components that are part of the GNOME environment.
Resources
Bonobo is the component architecture of the GNOME Project.
Bonobo is also a monkey. The Bonobo is the most genetically similar animal to human beings, and is also an endangered species. To learn more see http://www.gsu.edu/~wwwbpf/bpf.
You can download Bonobo at no charge.
The author works for Ximian, Inc.
IBM is a Board member of the GNOME foundation.
And GNOME is the desktop environment of the GNU Project.
Read why Richard Stallman started the GNU Project in 1984.
Richard Stallman also founded The Free Software Foundation, and authored the GNU General Public License (GPL).
IBM's best-known involvement with Free Software is with Linux (see also http://www-1.ibm.com/linux/).
When not busy chalking sidewalks in San Francisco with pro-Linux graffiti (CNN), IBM also finds time to release a number of its own technologies under the GPL including:
BlueDrekar wireless middleware
AFS file system
Jikes Java compiler
IBM even has its own Public License, called the IBM Public License, which was written in consultation with the Free Software Foundation to guarantee users' freedoms.
The part of the GPL which is often called "viral" by its detractors guarantees that GPLd software will remain GPLd.
Bonobo is based on CORBA technology. Find out more about CORBA, ORBs, IDL -- and all things CORBA-related -- at the OMG Web site.
ORBit is the CORBA implementation used by GNOME.
The Object Activation Framework (Oaf) is sort of like a DNS service for components.
GNOME uses Gtk+, a multi-platform toolkit for creating graphical user interfaces.
Full Bonobo API Reference Manual
If you liked this article, you may also be interested in the developerWorks Linux zone, and the developerWorks Open Source zone.
About the author
Michael is a Christian and enthusiastic believer in Free software. He very much enjoys working for Ximian Inc. where he gets paid to develop various free GNOME components, particularly ORBit2, Bonobo and GNOME 2 infrastructure. Prior to this he worked for Quantel gaining expertise in real time AV editing and playback achieved with high-performance focused hardware/software solutions. You can reach him at michael@ximian.com.