Modules organization
The customer management program is build from different modules with specific roles.
For best practice, you should organize your code in different modules by tasks, and publish only the functions, types, constants or module variables that are needed by other modules.
In the sample code of this chapter, the following modules are used to organize the source code by tasks:
- The
custmainmodule implements theMAINblock, and theMENUstatement to let the user choose an action to perform: query, append, update, delete rows. This module imports thecustqueryandcustdatamodules. - The
custquerymodule implements database query function with theCONSTRUCTinstruction, and uses an SQL cursor to handle the result set of theSELECTstatement. This module imports public symbosl - The
custdatamodule implements functions to append, update, delete customer rows. The module provides also user defined types such ast_cust_num, that can be reused by other modules to define their variables. - The
comutilsmodule implements utility functions, such as mbox_yn which shows a popup box to the user, and asks for a Yes/No answer.