Object-Oriented Programming Using SOM and DSOM: Difference between revisions
No edit summary |
mNo edit summary |
||
(23 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
''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. However, this book provides a lot of working examples that will help you to start using SOM to design and implement your applications. | |||
[[Category: | 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 Definition 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 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 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. | |||
==Content== | |||
# [[{{BASEPAGENAME}}/Introduction|Introduction]] | |||
## [[{{BASEPAGENAME}}/Introduction#What is SOM?|What is SOM?]] | |||
## [[{{BASEPAGENAME}}/Introduction#Why SOM?|Why SOM?]] | |||
## [[{{BASEPAGENAME}}/Introduction#SOM Architecture|SOM Architecture]] | |||
## [[{{BASEPAGENAME}}/Introduction#SOM Components|SOM Components]] | |||
## [[{{BASEPAGENAME}}/Introduction#SOM, OMG and CORBA|SOM, OMG and CORBA]] | |||
## [[{{BASEPAGENAME}}/Introduction#A First Look at IDL|A First Look at IDL]] | |||
## [[{{BASEPAGENAME}}/Introduction#SOM IDL, CORBA IDL, and ODL|SOM IDL, CORBA IDL, and ODL]] | |||
## [[{{BASEPAGENAME}}/Introduction#Language Bindings|Language Bindings]] | |||
## [[{{BASEPAGENAME}}/Introduction#Getting Started|Getting Started]] | |||
# [[{{BASEPAGENAME}}/Hello World in SOM|Hello World in SOM]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Some Basic Terminology|Some Basic Terminology]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Game Plan|Game Plan]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Development Steps|Development Steps]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Define Hello Interface|Define Hello Interface]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#SOM Compile Hello.idl|SOM Compile Hello.idl]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Customize the printHello Method|Customize the printHello Method]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Create Client Program|Create Client Program]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Compile and Link|Compile and Link]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Execute the Program|Execute the Program]] | |||
## [[{{BASEPAGENAME}}/Hello World in SOM#Summary|Summary]] | |||
# [[{{BASEPAGENAME}}/Understanding the Basics|Understanding the Basics]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#SOMObject, The Root Of All SOM Classes|SOMObject]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#SOMClass, THE ROOT OF ALL SOM METACLASSES|SOMClass]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#SOM Kernel Classes|SOM Kernel Classes]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#SOM Run-time Environment Initialization|SOM Run-time Environment Initialization]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#Attributes vs. Instance Variables|Attributes vs. Instance Variables]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#Public vs. Private|Public vs. Private]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#Inheritance|Inheritance]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#Parent Class vs. Metaclass|Parent Class vs. Metaclass]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#Metaclass Example|Metaclass Example]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#The SOMSinglelnstance Metaclass|The SOMSinglelnstance Metaclass]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#Derived Metaclass|Derived Metaclass]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#Method Resolution|Method Resolution]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#SOM Data Types|SOM Data Types]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#SOM Exceptions|SOM Exceptions]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#SOM Context|SOM Context]] | |||
## [[{{BASEPAGENAME}}/Understanding the Basics#Module Statement|Module Statement]] | |||
# [[{{BASEPAGENAME}}/A Complement to C++|A Complement to C++]] | |||
## [[{{BASEPAGENAME}}/A Complement to C++#The Need To Re-Compile|The Need To Re-Compile]] | |||
## [[{{BASEPAGENAME}}/A Complement to C++#Export Entry in DLLs|Export Entry in DLLs]] | |||
## [[{{BASEPAGENAME}}/A Complement to C++#Dynamic Class Loading|Dynamic Class Loading]] | |||
## [[{{BASEPAGENAME}}/A Complement to C++#Run-Time Type Identification|Run-Time Type Identification]] | |||
## [[{{BASEPAGENAME}}/A Complement to C++#Summary|Summary]] | |||
# [[{{BASEPAGENAME}}/Distributing Your Objects|Distributing Your Objects]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#DSOM Overview|DSOM Overview]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#Define and Implement Your Objects|Define and Implement Your Objects]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#Server Program|Server Program]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#Client Program|Client Program]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#Configuration|Configuration]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#Building and Registering the Classes|Building and Registering the Classes]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#Execution|Execution]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#A Checklist for DSOM Configuration|A Checklist for DSOM Configuration]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#Dynamic Invocation Interface|Dynamic Invocation Interface]] | |||
##[[{{BASEPAGENAME}}/Distributing Your Objects#A Distributed Calendar|A Distributed Calendar]] | |||
#[[{{BASEPAGENAME}}/Making Your Objects Persistent|Making Your Objects Persistent]] | |||
##[[{{BASEPAGENAME}}/Making Your Objects Persistent#PSOM Overview|PSOM Overview]] | |||
##[[{{BASEPAGENAME}}/Making Your Objects Persistent#Define and Implement a Persistent Object|Define and Implement a Persistent Object]] | |||
##[[{{BASEPAGENAME}}/Making Your Objects Persistent#Client Program|Client Program]] | |||
##[[{{BASEPAGENAME}}/Making Your Objects Persistent#Building and Registering the Classes|Building and Registering the Classes]] | |||
##[[{{BASEPAGENAME}}/Making Your Objects Persistent#Execution|Execution]] | |||
##[[{{BASEPAGENAME}}/Making Your Objects Persistent#A Distributed and Persistent Calendar|A Distributed and Persistent Calendar]] | |||
#[[{{BASEPAGENAME}}/Using Replicated Objects|Using Replicated Objects]] | |||
## [[{{BASEPAGENAME}}/Using Replicated Objects#RSOM Overview|RSOM Overview]] | |||
## [[{{BASEPAGENAME}}/Using Replicated Objects#Define and Implement a Replicated Object|Define and Implement a Replicated Object]] | |||
##[[{{BASEPAGENAME}}/Using Replicated Objects#Client Program|Client Program]] | |||
##[[{{BASEPAGENAME}}/Using Replicated Objects#Building and Registering the Classes|Building and Registering the Classes]] | |||
##[[{{BASEPAGENAME}}/Using Replicated Objects#TCP/IP|TCP/IP]] | |||
##[[{{BASEPAGENAME}}/Using Replicated Objects#Execution|Execution]] | |||
##[[{{BASEPAGENAME}}/Using Replicated Objects#A Replicated Calendar|A Replicated Calendar]] | |||
#[[{{BASEPAGENAME}}/Working with the Interface Repository|Working with the Interface Repository]] | |||
##[[{{BASEPAGENAME}}/Working with the Interface Repository#Who Uses the Interface Repository|Who Uses the Interface Repository]] | |||
##[[{{BASEPAGENAME}}/Working with the Interface Repository#Managing the Interface Repository|Managing the Interface Repository]] | |||
##[[{{BASEPAGENAME}}/Working with the Interface Repository#Building the Interface Repository|Building the Interface Repository]] | |||
##[[{{BASEPAGENAME}}/Working with the Interface Repository#Accessing the Interface Repository|Accessing the Interface Repository]] | |||
##[[{{BASEPAGENAME}}/Working with the Interface Repository#TypeCode|TypeCode]] | |||
##[[{{BASEPAGENAME}}/Working with the Interface Repository#A Simple IR Browser|A Simple IR Browser]] | |||
#[[{{BASEPAGENAME}}/Writing Your Own Emitter|Writing Your Own Emitter]] | |||
##[[{{BASEPAGENAME}}/Writing Your Own Emitter#What is an Emitter?|What is an Emitter?]] | |||
##[[{{BASEPAGENAME}}/Writing Your Own Emitter#Developing an Emitter|Developing an Emitter]] | |||
##[[{{BASEPAGENAME}}/Writing Your Own Emitter#Emitter Framework Classes|Emitter Framework Classes]] | |||
##[[{{BASEPAGENAME}}/Writing Your Own Emitter#A Report Emitter|A Report Emitter]] | |||
#[[{{BASEPAGENAME}}/Future Directions|Future Directions]] | |||
##[[{{BASEPAGENAME}}/Future Directions#IBM and Hewlett-Packard Announcement|IBM and Hewlett-Packard Announcement]] | |||
##[[{{BASEPAGENAME}}/Future Directions#Digitalk Announcement|Digitalk Announcement]] | |||
##[[{{BASEPAGENAME}}/Future Directions#ParcPlace Systems Announcement|ParcPlace Systems Announcement]] | |||
##[[{{BASEPAGENAME}}/Future Directions#WATCOM Announcement|WATCOM Announcement]] | |||
##[[{{BASEPAGENAME}}/Future Directions#Objective Inc. Announcement|Objective Inc. Announcement]] | |||
##[[{{BASEPAGENAME}}/Future Directions#DirectToSOM |DirectToSOM]] | |||
##[[{{BASEPAGENAME}}/Future Directions#VisualAge Announcement|VisualAge Announcement]] | |||
##[[{{BASEPAGENAME}}/Future Directions#Summary|Summary]] | |||
* [[{{BASEPAGENAME}}/References|References]] | |||
==Links== | |||
*[OOProgSOM-DSOM_Examples.zip] - source code companion disk | |||
[[Category:Books]] |
Latest revision as of 07:28, 26 December 2022
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. 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 Definition 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 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 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.
Content
- Introduction
- Hello World in SOM
- Understanding the Basics
- SOMObject
- SOMClass
- SOM Kernel Classes
- SOM Run-time Environment Initialization
- Attributes vs. Instance Variables
- Public vs. Private
- Inheritance
- 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
Links
- [OOProgSOM-DSOM_Examples.zip] - source code companion disk