• Which web framework should I use?• Why are there so many persistence API’s?• Which is better: Scala or Clojure (or Erlang)?• How should I use design patterns?• How do I build a good architecture?
Let’s do design!• OO language (Java)• We want to use the OCP• We’ll create one or more inheritance hierarchies!• Well...
Inheritance Hierarchies?• What do good ones look like?• Are there rules we can follow (best practices even)?• Are there traps we can fall in to?
The Liskov Substitution PrincipleBarbara Liskov
What is wanted here is something like the followingsubstitution property: If for each object o1 of type S there is an object o2 of type T such that for all programs P deﬁned in terms of T, the behavior of P is unchanged when o1 is substituted for o2, then S is a subtype of T.
Subtypes must besubstitutable for their base types.