Progress
Language Tutorial
for Character


Structuring an Event-driven Application

An event-driven application typically has a flat structure. There is a main procedure that creates the main user interface and presents the user with functionality choices in the form of buttons and menu commands. Normally, each button or menu command links to a trigger in the main procedure that runs an external procedure file. The procedure files are all very modular, performing a single task.

As your application grows, your tendency will be to define all resources that the individual procedures use in the main procedure file, including:

Figure 12–1 illustrates the flat structure of an event-driven interface.

Figure 12–1: Flat Structure of an Event-driven Application

Because the event-driven model promotes giving the user access to most functionality at the top level of an application’s interface, as opposed to a tree structure of screen menus, the main procedure that defines the top level of the application can get very large.

The tendency to grow the main procedure and keep the external procedures atomic modules can lead to problems. While you achieve modularity and ease of maintenance in the external procedures, the main procedure can become difficult to read and may tax the execution limits of your system.

One way to more easily maintain the main procedure might be to use include files to group related code. This may make the code easier to understand, but does not reduce the resource burden of having an overly large module of executable code.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095