Search This Blog

Sunday, February 14, 2010

OO Best Practices

  • The O/R Impedance Mismatch and Inheritance vs Relational Databases
  • (Prefer) Composition versus inheritance
  • SRP The Single Responsibility Principle A class should have one, and only one, reason to change.
  • OCP The Open Closed Principle You should be able to extend a classes behavior, without modifying it.
  • LSP The Liskov Substitution Principle Derived classes must be substitutable for their base classes.
  • DIP The Dependency Inversion Principle (aka IoC) Depend on abstractions, not on concretions.
  • ISP The Interface Segregation Principle Make fine grained interfaces that are client specific.
  • (also in clean code smells) The LawOfDemeter specifies a style guideline: "Only talk to your immediate friends." one never calls a method on an object you got from another call nor on a global object.
  • clean code (cc) Object/structure assymetry, data transfer object (DTO) active record is one example (don't put business logic in one)
  • tell, don't ask
  • Data professionals that claim that your object/component models must be driven by their data models

No comments:

Post a Comment