c# - building flexible and reusable class hierarchy -


let's review entities:

  • company;
  • collaborator;
  • chief;
  • subordinate workers.

there rules:

  1. collaborator 1 of these: sales, manager, employee;
  2. sales , manager have subordinate workers (of type decribed in 1st rule);
  3. sales, manager, employee have chief;
  4. 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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -