Object-Oriented Programming Practices
While Presentation Manager allows an application developer to implement
the fundamental concepts of object-oriented programming in his or her applications,
it does not restrict the application developer to the use of these conventions.
Therefore to ensure the correct implementation of object-oriented conventions
and to enable the maximum level of granularity, a number of guidelines are
offered:
The use of multi-purpose application objects (window
procedures) should be avoided; for example, a single window procedure should
not handle both user interaction and file access. Manipulation of separate
data objects should be achieved using separate window procedures. Background
data objects (that is, files or databases) should be manipulated using object
windows.
As a corollary of the above rule, multiple window
procedures should not be created to act upon a single data object; where
possible, all actions on a particular data object should be performed by
a single window procedure. This behavior simplifies any future maintenance
should the definition of the logical data entity or its representation change.
Note that this guideline may need to be overridden in circumstances where
an action requires lengthy processing, in order to preserve application
responsiveness.
The definition, creation and/or establishment of access
to data objects should be achieved, where possible, from within a window
procedure in order to preserve the concept of data encapsulation. That
is to say, the use of global data should be minimized in order to enhance
modularity and maximize object independence.
The input, output and behavior associated with a window
procedure should depend solely on the class and contents of the messages
it receives, and should not depend on any other external data or parameter,
other than a data structure to which a pointer is passed as a message parameter.
This preserves the concept of object polymorphism and enhances the potential
for reuse.
These guidelines, when obeyed, will enable an application to conform to
the established guidelines for object-oriented programming as discussed
in Object-Oriented Applications.
[Back: Function and Data Types]
[Next: Application Main Routine]