Object-Oriented Programming Using SOM and DSOM
This book is for people interested in learning IBM's System Object Model (SOM). It is the result of my experiences with using SOM to build various applications. The SOMobjects Developer Toolkit comes with a huge volume of documentation. However, first time users generally find it difficult to locate the information they need to begin using SOM effectively. This book is my attempt to provide specific information on some of the most commonly asked questions. It does not attempt to replace the SOM documentation, and does not use every feature of SOM. However, this book provides a lot of working examples that will help you to start using SOM to design and implement your applications.
This book assumes you have some knowledge of C and C++, and some basic understanding of object-oriented programming. If you are an experienced object oriented programmer, you can jump into the examples provided in this book and become a productive SOM programmer in a very short time. If you are new to object-oriented programming, this book will help you understand some of the problems with existing object-oriented languages, and provide you with solutions to these problems.
History of SOM
IBM first introduced the System Object Model with Version 2.0 of OS/2. It provides a language-neutral environment for building object-oriented class libraries. SOM objects are said to be language neutral because they can be implemented in one programming language, and used by programs written in another language. SOM objects also maintain full backward binary compatibility, classes implemented in SOM can undergo structural changes without requiring recompilation of client code. This makes it easier for users to install new releases of class libraries.
The most significant application built on SOM is the OS/2 Workplace Shell. The Workplace Shell is implemented as a set of classes that are subclassed from SOM base classes. The full backward binary compatibility of SOM is clearly demonstrated by the Workplace Shell with the new release of SOM. A user can install a new release of SOM without affecting any existing Workplace Shell objects. There is no need to recompile, or relink, any of your existing Workplace Shell applications. The second release of SOM was introduced in June 1993. This release was a major step up from SOM Version 1.0, and is available on both AIX/6000 and OS/2. SOM Version 2.0 has also been announced for the Windows environment, and will be generally available in the summer of 1994. The most important additions in this release were:
- C++ bindings that allow you to implement and invoke your classes in C++.
- The Distributed, Persistence, Replication and Emitter Frameworks.
- CORBA compliance, SOM classes are now described in CORBA's Interface Definjtion Language (IDL) instead of OIDL.
- Support for multiple inheritance.
- Interface Repository for run-time typing information.
How This Book Is Organized
This book is organized as follows:
- Chapter 1, Introduction, gives an overview of SOM.
- Chapter 2, Hello World in SOM, shows you the basic steps that are involved in creating a SOM object.
- Chapter 3, Understanding the Basics, examines the SOM system, the concepts of classes, metaclasses, inheritance, and method-resolution.
- Chapter 4, A Complement to C++, discusses how SOM complements C++, by providing some of the dynamic characteristics that are not available in C++.
- Chapter 5, Distributing Your Objects, examines the Distributed SOM Framework. Here we begin our journey to build an application that works with distributed, persistent and replicated objects.
- Chapter 6, Making Your Objects Persistent, examines the Persistence SOM Framework. We continue with the example we began in Chapter 5 and add persistence to the objects we created.
- Chapter 7, Using Replicated Objects, examines the Replication SOM Framework. We continue with our e:lffim.ple and make replicas of our objects. We also implement an event notification system that uses the Replication Framework to broadcast changes on objects.
- Chapter 8, Working with the Interface Repository, discusses the database that SOM uses to maintain information about its classes.
- Chapter 9, Writing Your Own Emitter, examines the Emitter Framework. We build a report emitter using the Emitter Framework.
- Chapter 10, Future Directions, concludes the book and discusses some of the on-going work and the future directions of SOM.
I want to thank Hann Sluiman for his enthusiasm and encouragement throughout the writing process.
Ashok Malhotra and Andy Martin read the entire manuscript and provided numerous suggestions and insights. I am deeply grateful for their contribution and personal commitment to reviewing the book in a very short period of time.
Bart Jacob, Hann Sluiman, Marc Smith and Hendra Suwanda also reviewed part of the manuscript and provided invaluable comments. Their suggestions I have made this a better book.
I appreciate the support of the many people at IBM. Bob Orfali, Gail Ostrow, and Roger Sessions, especially, have encouraged and supported the publishing activity.
I must thank Ron Holt for so generously lending me his ThinkPad. It sped up the writing process.
Dianne Littwin and her staff at VNR were great to work with and very responsive to my UI•gent desire to get this book to market.
Finally, a special thanks to the SOM team for creating this superb product.
- Hello World in SOM
- Understanding the Basics
- SOM Kernel Classes
- SOM Run-time Environment Initialization
- Attributes vs. Instance Variables
- Public vs. Private
- Parent Class vs. Metaclass
- Metaclass Example
- The SOMSinglelnstance Metaclass
- Derived Metaclass
- Method Resolution
- SOM Data Types
- SOM Exceptions
- SOM Context
- Module Statement
- A Complement to C++
- Distributing Your Objects
- Making Your Objects Persistent
- Using Replicated Objects
- Working with the Interface Repository
- Writing Your Own Emitter
- Future Directions
- source code companion disk