Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
work:clean_code_notes [13 years ago - 2012/12/17 21:58] aogailwork:clean_code_notes [13 years ago - 2013/01/04 21:54] (current) – [Clean Code notes] aogail
Line 1: Line 1:
 ====== Clean Code notes ====== ====== Clean Code notes ======
 +
 +===== Liskov substitution principle =====
 +
 +==== What is a type ====
 +
 +It is a bag of operations
 +
 +==== Subtypes ====
 +
 +A subtype is a type that may be used as another type.
 +
 +==== Refused bequest ====
 +
 +This occurs when a subtype does something unexpected from the point of view of the user of the super type. 
 +
 +  * does not implement method
 +  * method does something unexpected
 +  * etc.
 +
 +Every refused bequest/LSP violation is a latent open/closed principle violation. 
 +
 +==== Representative rule ====
 +
 +Representatives of things do not share the relationships of the things they represent. So, while geometrically a square is a rectangle, the class that represents a square is not a subtype of the class that represents a rectangle. 
 +
 +
  
 ===== Single responsibility principle ===== ===== Single responsibility principle =====