| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (8 out of 9)

Managing Multi-Module Applications

When a module operates in a hierarchical environment, you must coordinate its interaction with other modules in the hierarchy. In many cases, it is not feasible to coordinate actions on a strictly peer-to-peer basis - a central coordinating agent is needed. This is the role of the G2 Foundation Resources module (GFR). GFR establishes standard approaches for several module interaction styles. By following GFR approaches, you help to assure the compatibility of your module with modules written by other authors who also use GFR.

We recommend that your module require GFR, directly or indirectly, and that your module use some or all of these GFR facilities:

For detailed information on how to use these facilities, see the G2 Foundation Resources User's Guide.

Module Initialization

GFR organizes the initialization of modules during G2 startup and warmboot, so that modules lower in the module hierarchy are initialized before dependent modules higher in the hierarchy. You should always use GRF when your module has initialization actions that must occur when you:

You cannot depend on prioritized initially rules to provide this function because you cannot assure the correct order of startup unless the end user carefully adjusts the rule priorities whenever the module hierarchy is changed.

Version Control

When developing or using multiple-module KBs, especially during team development, you will find version dependencies between modules difficult to document and enforce. GFR provides utilities for determining and validating the version dependencies between modules, and between the module and G2. The version checking system warns the user when an incompatible set of modules is loaded and also dispatches user-defined upgrade procedures when a new version of a supporting module is loaded.

Module Settings

Modules often feature user-customizable settings that control certain aspects of the module's behavior or define the resources to be used by the module. In modular KBs, competitions for the use of these settings might arise, for example, when two modules attempt to customize the settings of a common required module. GFR provides a standard approach for defining module settings and resolving potential competitions, in a manner similar to G2 system tables.

Communications and Error Handling

GFR provides a model of object-oriented user communications and error handling that allows a top-level module to dictate the style of the end-user interface, even when it is built upon supporting modules written by other authors. If you structure all user communications according to this model, you can avoid imposing an interface style on higher-level modules.

Message Localization

GFR provides the basic tools for engineering KBs that you can easily translate into other languages. While G2 provides the capability of translating the texts appearing on its menus, it does not provide a structured approach to translating free texts and messages in an application's user interface. This facility includes a convenient way to implement localizable messages that contain substrings whose values are determined at run time.


Caution: In general, you should not include fixed text strings or free texts in your module, such as error messages, alerts, inform statements, dialog texts, and menu labels. Hard-coding these texts prevents your application from being translated into other languages. Unless you are sure your module will never need to support local languages, use the translation facility of GFR as a dynamic text server.

Palette Management

GFR provides a convenient approach for implementing palettes, which are workspaces with click-to-clone objects. Palettes are a convenient way to create instances of the objects the icon represents.

GFR palettes optionally provide pop-up "bubble help" that describe the object currently under the mouse. You can also make GFR palettes proprietary to prevent the end user from making unauthorized changes.

Text Parsing and Other Utilities

G2 provides basic file management utilities, such as the ability to open and close files, and read and write lines of text. When you read a file, using these utilities, you are forced to write parsing routines to separate the resulting text string into its lexical elements.

While GFR does not address this problem directly, it does provide a utility that converts the contents of a file into a list containing G2 value types (floats, integers, symbols, texts, and truth-values). Once a file has been converted into a value list, further text parsing is usually unnecessary.

The GDI utility also provides a facility for reading and writing files. For more information on GDI, see Using GDI to Create an Interface.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (8 out of 9)

Copyright © 1997 Gensym Corporation, Inc.