dimanche 29 mars 2015

Appropriate design for hierarchy object initialization

I am not sure what is the appropriate design for my program. I like to develop a code that contain 3 types (levels).



  1. Manager

  2. Officer

  3. Employee


while the Employee has some fields, the Officer has the same fields with some extension and the Manager have all (they inherits one from each other).


My question is what appropriate design should I use to build those objects? I thought about: 1. "Builder" design, which can create part of the object and you can extend it, if you need to use higher level. 2. Some articles point that I should use "Composite" design.


Any advise will be blessed , Im open for suggestion and for new design. IF you can please add example. Thanks.


Aucun commentaire:

Enregistrer un commentaire