Abstraction - Upstream and Downstream

 

Downstream

Creation of Children Classes to further abstract related class details.

 

When not to do downstream abstraction

  • when abstracting based on a range of values
    e.g. height in People.
        Should you split People into Tall, Medium and Short subclasses?
    • If it is functional more usefull to have AND
    • They values are treated differently


  • when abstracting based on a limited set of values
    e.g. People has attribute gender.....should we split into subclasses Male, Female?

 

 

Upstream

The idea here is we have a class (or classes) that we create a parent for.

Often not a good idea as used by programmers to fix a design flaw.

Consider creating a interface before the creation of a real super-class.

© Lynne Grewe