Mastering PowerBuilder

HomePrevious Lesson: Course 3:: Session 24 :: Page 30
Next Lesson: Course 3:: Session 24 :: Page 50
General Purpose Classes

Classes that place all potentially required functionality into one ancestor class belongs to this category. That means methods are defined for any possible functionality for that object. When the developer use this class, he turns on and off the functionality in one of the following ways:
Call the method with a lot of arguments with TRUE/FALSE values. ( In the ancestor class, the code uses IF...ELSEIF statement to check the argument value and acts accordingly )
Call separate functions to turn on/off the functionality and then calls the actual method. ( In the ancestor class, boolean instance variables are defined and in the method’s code IF...ELSEIF statement is used to check whether the instance variable is turned on/off. )

A typical example of a general purpose class is a DataWindow with all the functionality as shown in the following picture:


Fat Ancestor DW UO with all the required functions.

There are a few disadvantages with the general purpose classes:
Fat ancestor classes
Potentially unnecessary functionality in some situations. For example, a method to add a new record is not required when the DataWindow is used for reporting purpose.

HomePrevious Lesson: Course 3:: Session 24 :: Page 30
Next Lesson: Course 3:: Session 24 :: Page 50