A cheat sheet showing the most common quality measures and design principles.
Measures that help you determine the quality of software.
The strength of linkage between elements.
Elements change together? Couple them tightly.
Elements change independently? Couple them loosely.
When you change a small part in an isolated area unrelated features break.
When you make a simple focussed change needing to update code in many places.
The degree to which elements that belong together are placed together.
Elements are related to the same concept? Put them inside the same class.
Elements are unrelated? Move them into different classes.
Defining which "concept" or "concern" to organise by.
Coupling.
Hide details inside an interface of an element.
Coupling. Abstraction. Primitive Obsession.
Principles that make code easy to work with.
Prefer domain terms over technology terms.
What > How
Encapsulation. Abstraction.
Hide details behind a higher level interface.
Business > Technology Encapsulation Coupling
Prefer writing new classes over modifying existing classes.
Creating the right abstracton to wrap up existing behaviour in a class.
Encapsulation. Abstraction. Polymorphism.
Multiple classes with same interface but different behaviour.
Look for opportunities to make classes swappable.
Encapsulation. Abstraction. Open / Closed Principle.
Prefer telling objects what to do rather than asking them questions.
Encapsulation. Dependency inversion.
Instead of calling an object that has behaviour, supply the behaviour to the object.
Encapsulation. Abstraction.