10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

InheritanceAggregation (Containing)Examples of OpenROAD system classes that follow this relationship model areActiveField and ButtonField. ActiveField is an abstract class that defines thecharacteristics and behavior of all fields with which users can interact. TheButtonField class is a subclass of ActiveField that provides an area on the formor which the user can initiate an action. Its characteristics and behavior aremore specifically defined than its parents.The aggregation inter-class relationship describes an object that is composedof separate, smaller objects that function together. The Employee and Jobclasses provide an example:• The Job object contains attributes (such as Title, Class, and Pay) thatdescribe a specific job held by a specific employee during a specified time.• An Employee object consists not only of scalar attributes (such asLastName and HireDate) but also of a complete job history for eachposition the employee has filled at the company. (For a full description ofthis class, see How Polymorphism Works (see page 125).)The JobHistory attribute of the Employee class, which is an array of Jobobjects, exemplifies an aggregation relationship.Although the data pertaining to employees is stored in several database tablesand structured in different user classes, the application user who manipulatesthe Employee object does not think in terms of the separate objects composingthe whole, but works with the aggregate as a single object. Aggregate objectsallow far more complicated structures than simple objects.An example of an OpenROAD system class that follows this relationship modelis TableFields. TableFields contain such other classes as an optional scrollbar(ScrollBarField), an optional control menu (ControlButton), and an array ofcolumn fields (StackField).Most objects participate in both types of relationships simultaneously. Forexample, Employee and Job are both members of an inheritance hierarchy andshare an aggregation relationship.User Class HierarchiesYou can organize your user classes into an inheritance hierarchy similar to thehierarchy of the OpenROAD system classes. The Employee superclass withPermanentEmployee and TempEmployee subclasses is one such example.Working with Classes 123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!