Design principles mostly taken from Head First Object-Oriented Analysis & Design
|
Encapsulate what varies.
|
|
Code to an interface rather than to an implementation.
|
|
Each class in your application should have only one reason to change.
|
|
Classes are about behavior and functionality.
|
|
Abstraction
|
The process of separating ideas from specific instances of those ideas at work.
|
|
Polymorphism
|
The provision of a single interface to entities of different types. Subtyping.
|
|
Inheritance
|
When an object or class is based on another object or class, using the same implementation; it is a mechanism for code reuse. The relationships of objects or classes through inheritance give rise to a hierarchy.
|
|
Encapsulation
|
Enclosing objects in a common interface in a way that makes them interchangeable, and guards their states from invalid changes
|
|
Delegation
|
When you hand over the responsibility for a particular task to another class or method.
|
|
Composition
|
Use behavior from a family of other classes, and change that behavior at runtime.
|
|
Aggregation
|
When one class is used as part of another class, but still exists outside of that other class.
|
|
Every object in your system should have a single responsibility, and all the object's services should be focused on carrying out that single responsibility.
|
Encapsulation at its finest :D
Thanks! It really helps.
Thanks for the comment! Glad someone finds it useful!
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.