c# - building flexible and reusable class hierarchy -
let's review entities:
- company;
- collaborator;
- chief;
- subordinate workers.
there rules:
- collaborator 1 of these: sales, manager, employee;
- sales , manager have subordinate workers (of type decribed in 1st rule);
- sales, manager, employee have chief;
- each role has own salary calculation method.
so target create flexible & reusable class hierarchy.
first thing confuses me "can have" phrase. should implemented composition? if said "can have many" should composition list of objects?
should create abstract class collaborator , inherit 3 other types or there more smart way?
what best way tie entities , have reusable assembly?
"can have"
, fact followed "workers"
, tells me "has a"
relationship (composition) 0 many relationship (so list mention empty)
an abstract class collaborator seems reasonable.
Comments
Post a Comment