Object-Oriented Programming Using SOM and DSOM

By Christina Lau

Preface
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. How­ever, 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 pro­vides 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:
 * 1) C++ bindings that allow you to implement and invoke your classes in C++.
 * 2) The Distributed, Persistence, Replication and Emitter Frameworks.
 * 3) CORBA compliance, SOM classes are now described in CORBA's Interface Definition Language (IDL) instead of OIDL.
 * 4) Support for multiple inheritance.
 * 5) 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 con­cepts 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 Frame­work. Here we begin our journey to build an application that works with dis­tributed, 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 Frame­work. We continue with our example 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.

Acknowledgments
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 respon­sive to my UI•gent desire to get this book to market.

Finally, a special thanks to the SOM team for creating this superb product.

Content

 * 1) Introduction
 * 2) What is SOM?
 * 3) Why SOM?
 * 4) SOM Architecture
 * 5) SOM Components
 * 6) SOM, OMG and CORBA
 * 7) A First Look at IDL
 * 8) SOM IDL, CORBA IDL, and ODL
 * 9) Language Bindings
 * 10) Getting Started
 * 11) Hello World in SOM
 * 12) Some Basic Terminology
 * 13) Game Plan
 * 14) Development Steps
 * 15) Define Hello Interface
 * 16) SOM Compile Hello.idl
 * 17) Customize the printHello Method
 * 18) Create Client Program
 * 19) Compile and Link
 * 20) Execute the Program
 * 21) Summary
 * 22) Understanding the Basics
 * 23) SOMObject
 * 24) SOMClass
 * 25) SOM Kernel Classes
 * 26) SOM Run-time Environment Initialization
 * 27) Attributes vs. Instance Variables
 * 28) Public vs. Private
 * 29) Inheritance
 * 30) Parent Class vs. Metaclass
 * 31) Metaclass Example
 * 32) The SOMSinglelnstance Metaclass
 * 33) Derived Metaclass
 * 34) Method Resolution
 * 35) SOM Data Types
 * 36) SOM Exceptions
 * 37) SOM Context
 * 38) Module Statement
 * 39) A Complement to C++
 * 40) The Need To Re-Compile
 * 41) Export Entry in DLLs
 * 42) Dynamic Class Loading
 * 43) Run-Time Type Identification
 * 44) Summary
 * 45) Distributing Your Objects
 * 46) DSOM Overview
 * 47) Define and Implement Your Objects
 * 48) Server Program
 * 49) Client Program
 * 50) Configuration
 * 51) Building and Registering the Classes
 * 52) Execution
 * 53) A Checklist for DSOM Configuration
 * 54) Dynamic Invocation Interface
 * 55) A Distributed Calendar
 * 56) Making Your Objects Persistent
 * 57) PSOM Overview
 * 58) Define and Implement a Persistent Object
 * 59) Client Program
 * 60) Building and Registering the Classes
 * 61) Execution
 * 62) A Distributed and Persistent Calendar
 * 63) Using Replicated Objects
 * 64) RSOM Overview
 * 65) Define and Implement a Replicated Object
 * 66) Client Program
 * 67) Building and Registering the Classes
 * 68) TCP/IP
 * 69) Execution
 * 70) A Replicated Calendar
 * 71) Working with the Interface Repository
 * 72) Who Uses the Interface Repository
 * 73) Managing the Interface Repository
 * 74) Building the Interface Repository
 * 75) Accessing the Interface Repository
 * 76) TypeCode
 * 77) A Simple IR Browser
 * 78) Writing Your Own Emitter
 * 79) What is an Emitter?
 * 80) Developing an Emitter
 * 81) Emitter Framework Classes
 * 82) A Report Emitter
 * 83) Future Directions
 * 84) IBM and Hewlett-Packard Announcement
 * 85) Digitalk Announcement
 * 86) ParcPlace Systems Announcement
 * 87) WATCOM Announcement
 * 88) Objective Inc. Announcement
 * 89) DirectToSOM
 * 90) VisualAge Announcement
 * 91) Summary


 * References

Links

 * source code companion disk