| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (4 out of 19)

Overview of the Class Definition Process

The following outline summarizes the use of a CLASS-DEFINITION to define a class.

To create a CLASS-DEFINITION:

  1. Instantiate a CLASS-DEFINITION onto a workspace.

To specify the attributes of the class:

  1. Specify the class's name and superior class(es).

  2. When the superior classes have been specified, G2 supplies values to read-only attributes that show:

  3. Define any attributes that are specific to the new class, and specify their default values.

  4. Override default values as needed for attributes inherited from user-defined superior classes.

  5. Provide default values for attributes inherited from system-defined superior classes.

To specify other properties of the class:

  1. Specify any configurations that apply to the CLASS-DEFINITION itself.

  2. Specify any configurations that apply to instances of the class defined.

  3. Specify the instantiability of the class (if applicable).

  4. Specify the icon of the class (if applicable).

This outline orders the various steps to highlight their functional groupings. The order in which the steps are described in this chapter is optimized to facilitate learning and reference. The order in which the steps are actually performed varies widely. Any order that results in a correct definition will work.

You can define classes either interactively, by instantiating and completing a definition, or programmatically, by writing procedures that use the create action. Most of this chapter describes interactive class definition. Programmatic class definition is described under Creating New Classes Programmatically.

The development of a class often requires changing various aspects of its definition over time. Such changes can be made in any order: all that matters is the ultimate correctness of the definition. When no class instances exist, changing a class requires only changing the relevant attribute(s) of the definition. When instances exist, they must be then updated to reflect the new definition, as described under Changing Definitions.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (4 out of 19)

Copyright © 1997 Gensym Corporation, Inc.