Mastering PowerBuilder

HomePrevious Lesson: Course 3:: Session 24 :: Page 40
Next Lesson: Course 3:: Session 24 :: Page 60
Nested General Purpose Classes

Classes of this type define the generic functionality in the super ancestor. The ancestor class is sub-classed and the functionality is added until all required combinations of functionality is defined. For example, in the following diagram, u_dw_for_data_entry has methods for adding a new record, find & replace. u_dw_for_reports has method for sorting the DataWindow.


DataWindow User Objects with deep hirerchy

Later if you need a DataWindow with adding new record, find & replace as well as sorting the DataWindow, you need to create one more class by inheriting from one of those two sub-classes "u_dw_for_data_entry", "u_dw_for_reports" and duplicate the code from other class. This is because, multiple inheritance is not possible in PowerBuilder. What it means to us?
Potentially a deep class hierarchy to provide every combination of functionality
Objects & code duplication instead of re-using them
More maintenance because of multiple copies of code & objects

The developer (user of your class library) turn the functionality on by using appropriate class from the hierarchy.

HomePrevious Lesson: Course 3:: Session 24 :: Page 40
Next Lesson: Course 3:: Session 24 :: Page 60