In addition to code reuse at the application object level, significant productivity gains can be achieved by the reuse of application code at the subroutine level, to carry out common operating system and Presentation Manager functions.
For example, initialization functions are required to perform tasks related to initializing the Presentation Manager environment and any data areas to be used by utility routines. Functions required to be performed include:
These functions may be combined into one or more standard initialization routines, which may be invoked upon entry to an application or thread. Examples of the necessary code are given in Figure "Sample Application Main Routine (Part 1) - Registration", Figure "Sample Application Main Routine (Part 2) - Window Creation" and Figure "WinAddSwitchEntry() Function".
Termination functions required by Presentation Manager applications could also be standardized; these functions include:
These operations are performed by Presentation Manager upon termination of the application if the application does not perform them explicitly. However, it is recommended that the application carries out these actions, since they may then be achieved in a controlled manner. Examples of the necessary code are given in Figure "Sample Application Main Routine (Part 2) - Window Creation".
Other functions may often be required during the execution of an application, such as:
These functions may also be combined into standard subroutines and placed in a library, thereby avoiding the need for application developers to repetitively code such functions.
A final function often used in the stepwise development of object-oriented Presentation Manager applications is a small routine to display a message box with the message "Action Not Yet Implemented", invoked when the user selects a menu bar or pulldown entry for which a method has not yet been coded. This function is typically invoked as the default case for the WM_COMMAND message class. In this way, methods within a window procedure may be implemented in a stepwise manner, and testing of existing methods may occur while new ones are being added. Selecting an action for which no method has yet been implemented will always result in the same message box being displayed.