[Contents] [Previous] [Next]

Framework programs

Even event loop programs require programmers to write a lot of code that shouldn't need to be written separately for every application. The concept of an application framework carries the event loop concept further, as suggested by the right side of Figure 12. Instead of dealing with all the nuts and bolts of constructing basic menus and windows and dialog boxes and making them all work together, programmers using application frameworks like those provided by the CommonPoint system start with working application code and basic user interface elements in place, and then build from there by replacing some of the generic capabilities of the framework with the specific capabilities of the intended application.

As Figure 12 suggests, application frameworks reduce the total amount of code that a programmer has to write from scratch. However, because the framework is really a generic application that displays windows, supports copy and paste, and so on, the programmer can also relinquish control to a greater degree than event loop programs permit. The framework code takes care of almost all event handling and flow of control, and the programmer's code gets called only when the framework needs it--to create or manipulate a proprietary data structure, for example.

A programmer writing a framework program not only relinquishes control to the user (as is also true for event loop programs), but also relinquishes the detailed flow of control within the program to other programmers--namely, those who wrote the framework. This approach allows the labors of different programmers to be combined to create more complex systems that work together in interesting ways, as opposed to isolated individuals creating custom code over and over again for similar problems.


[Contents] [Previous] [Next]

Addison-Wesley Publishing Company, Copyright©1995 by Sean Cotter and Taligent,Inc. All rights reserved.