Design Principle 1
#Object Oriented Programming design principle
“Identify the aspects of your application that vary and separate them from what stays the same.”
This design principle is very important as object oriented programming, while it promises logical encapsulation and convenient code reuse, it is wise and more efficient to separate parts of a class that varies and encapsulate them from the parts that are constant. Doing so makes it easier to maintain and modify the varying parts without affecting those that don’t.
Not everything that relates to a particular class needs to be in the same scope as the class for the sake of relation and coherence. Often times it becomes a problem when it comes to maintainability, as programmers spend most of their time maintaining rather than building the code from scratch.
Resources
Head First Design Pattern by Elisabeth Freeman and Kathy Sierra
↩︎