Object-Oriented Programming Using SOM and DSOM

From EDM2
Jump to: navigation, search

By Christina Lau


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 Definjtion 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 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 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.


  1. Introduction
    1. What is SOM?
    2. Why SOM?
    3. SOM Architecture
    4. SOM Components
    5. SOM, OMG and CORBA
    6. A First Look at IDL
    7. SOM IDL, CORBA IDL, and ODL
    8. Language Bindings
    9. Getting Started
  2. Hello World in SOM
    1. Some Basic Terminology
    2. Game Plan
    3. Development Steps
    4. Define Hello Interface
    5. SOM Compile Hello.idl
    6. Customize the printHello Method
    7. Create Client Program
    8. Compile and Link
    9. Execute the Program
    10. Summary
  3. Understanding the Basics
    1. SOMObject
    2. SOMClass
    3. SOM Kernel Classes
    4. SOM Run-time Environment Initialization
    5. Attributes vs. Instance Variables
    6. Public vs. Private
    7. Inheritance
    8. Parent Class vs. Metaclass
    9. Metaclass Example
    10. The SOMSinglelnstance Metaclass
    11. Derived Metaclass
    12. Method Resolution
    13. SOM Data Types
    14. SOM Exceptions
    15. SOM Context
    16. Module Statement
  4. A Complement to C++
    1. The Need To Re-Compile
    2. Export Entry in DLLs
    3. Dynamic Class Loading
    4. Run-Time Type Identification
    5. Summary
  5. Distributing Your Objects
    1. DSOM Overview
    2. Define and Implement Your Objects
    3. Server Program
    4. Client Program
    5. Configuration
    6. Building and Registering the Classes
    7. Execution
    8. A Checklist for DSOM Configuration
    9. Dynamic Invocation Interface
    10. A Distributed Calendar
  6. Making Your Objects Persistent
    1. PSOM Overview
    2. Define and Implement a Persistent Object
    3. Client Program
    4. Building and Registering the Classes
    5. Execution
    6. A Distributed and Persistent Calendar
  7. Using Replicated Objects
    1. RSOM Overview
    2. Define and Implement a Replicated Object
    3. Client Program
    4. Building and Registering the Classes
    5. TCP/IP
    6. Execution
    7. A Replicated Calendar
  8. Working with the Interface Repository
    1. Who Uses the Interface Repository
    2. Managing the Interface Repository
    3. Building the Interface Repository
    4. Accessing the Interface Repository
    5. TypeCode
    6. A Simple IR Browser
  9. Writing Your Own Emitter
    1. What is an Emitter?
    2. Developing an Emitter
    3. Emitter Framework Classes
    4. A Report Emitter
  10. Future Directions
    1. IBM and Hewlett-Packard Announcement
    2. Digitalk Announcement
    3. ParcPlace Systems Announcement
    4. WATCOM Announcement
    5. Objective Inc. Announcement
    6. DirectToSOM
    7. VisualAge Announcement
    8. Summary