OODP Review.

I took a three hour mini-course on OO Design Principles. Now, go brush up on your OODP and more of its acronyms.

1) Polymorphism: behavior that varies depending on the function’s class being invoked.
2) Hierarchy: a) Inheritance – allow a subclass to access members of the parent class. b) Aggregation – objects can contain one or more objects of another object.
3) Encapsulation: hide/reaveal particular details of a class.
4) Abstraction: hide the details of an subclass.
5) Objects/Classes: collection of characteristics that describe something whether it is abstract or tangible; object is an instance of a class.

SRP (Single Responsibility Principle): a class should be responsible for only one thing.
DRY (Don’t Repeat Yourself): self explanatory, don’t copy/paste.
LSP (Liskov Substitution Principle): “Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.”
DIP (Dependency Inversion Principle): “High level modules should not depend upon low level modules. Both should depend on abastractions. Abstractions should not depend of details. Details should depend on abstractions.”
OCP (Open Closed Principle): Classes, methods, functions “should be open for extension, but closed for modification.”
ISP (Interface Segregation Principle): “Clients should not be forced to depend upon interfaces that they do not use.”
CCP (Common Closed Principle): “Classes within a released component should share common closure. If one need to be changed, they all are likely to need to be changed. What affects one, affects all.”
ADP (Acyclic Dependency Principle): The dependency structure for released component must be a Directed Acyclic Graph. There can be no cycles.”
SDP (Stable Dependency Principle): “Dependencies between released components must run in the direction of stability. The dependee must be more stable than the depender.”
SAP (Stable Abstraction Principle): “The more stable a component is, the more it must consist of abstract classes. A completely stable category should consist of nothing but abstract classes.”
RREP (Reuse/Release Equivalency Principle):“The granularity of reuse is the same as the granularity of release. Only components that are released through a tracking system can be effectively reused.”

If you want to read more about any of these, go check out ObjectMontor. They have a lot more documents and articles there to read.

I hope I’m not missing any important ones, if so add some to the list.

One thought on “OODP Review.

  1. Most of those principles are harder to implement than they seem. It’s one thing to know the definition of a principle and another to know when and how to apply it to your design

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve this: Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.