skip to main content
OpenEdge Development: ADM and SmartObjects
Overview : Super procedures
 
Super procedures
In the ADM methodology, most of the support code for an object type resides in a super procedure: a separately compiled procedure built as a structured .p file. For instance, the super procedure for SmartDataViewers is viewer.p. A super procedure can include both object‑specific routines and object‑specific versions of standard routines defined further up the ADM class hierarchy. (See Figure 1–1.)
Super procedures are a Progress 4GL concept rather than an ADM concept. The remainder of this section describes how the ADM uses Progress 4GL super procedures.
External procedures, internal procedures, and functions
An understanding of Progress 4GL procedure types is basic to an understanding of ADM super procedures. The ADM uses two Progress 4GL procedure types: external procedures and internal procedures. In addition, it uses 4GL functions. Internal procedures and functions are collectively referred to as methods:
External procedures are procedure files that typically have a .w or .p extension. External procedures can become persistent procedures at run time. A persistent procedure is a run‑time instance of an external procedure that stays in memory until it is explicitly deleted. SmartObjects are implemented as run‑time instances of external procedures.
Internal procedures are contained by external procedures. An internal procedure is a named entry point that can be executed by its containing external procedure or by other external procedures. Internal procedures represent actions that a SmartObject can perform.
Functions also are contained by external procedures. A function, like an internal procedure, can be executed by its containing external procedure or by other external procedures. Functions also represent actions a SmartObject can perform.
Figure 1–3 illustrates the relationship among external procedures, internal procedures, and functions.
Figure 1–3: External procedures, internal procedures, and functions
For more information on procedure types, see OpenEdge® Getting Started: ABL Essentials.
Super procedures in the ADM
In the ADM, a super procedure is a persistent procedure that contains versions of internal procedures or functions designed to be run remotely on behalf of SmartObjects. The use of super procedures provides a measure of inheritance and the ability to customize each internal procedure or function. Figure 1–4, which illustrates the inheritance process, shows how different versions of the same internal entry (in this example, the initializeObject procedure) exist in different super procedures.
Figure 1–4: Inheritance and the super procedure stack
The super procedures designed for SmartObjects are designed to be shared and stateless. This means that a given super procedure such as viewer.p is run only once in a session, no matter how many SmartDataViewers there are; each SmartDataViewer designates the same instance of the compiled code for viewer.p as its super procedure.
ADM super procedures use the Progress 4GL SOURCE-PROCEDURE and TARGET-PROCEDURE functions to provide information to their routines about who called them and for whom:
*The SOURCE-PROCEDURE function allows a routine in a super procedure to know who ran it, eliminating the need to pass TARGET-PROCEDURE as a handle to the routine.
*The TARGET-PROCEDURE function allows a routine in a super procedure to know on whose behalf it was invoked.
For more information on the SOURCE-PROCEDURE and TARGET-PROCEDURE functions, see OpenEdge Development: ABL Reference.