Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It takes a lot of discipline but the rewards in productivity and code robustness are worth it.

Apply SOLID design principles

SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym that stands for five basic principles of object-oriented programming and design. The principles, when applied together, intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time.

...

InitialStands forConcept
SSRP [4]

Single responsibility principlea class should principle. A class should have only a single responsibility (i.e. only one potential change in the software's specification should be able to affect the specification of the class)

OOCP [5]

Open/closed principle“software principle “software entities … should be open for extension, but closed for modification.”

LLSP [6]

Liskov substitution principle“objects principle “objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.” See also design by contract.

IISP [7]

Interface segregation principle“many principle “many client-specific interfaces are better than one general-purpose interface.”[8]

DDIP [9]

Dependency inversion principleone principle one should “Depend upon Abstractions. Do not depend upon concretions.”[8]

When updating or re-factoring code or when designing new modules, please test your design against these principles.

For more information and generally good reading about design try PrinciplesOfOod and SOLID Principles.

 

Packaging

One of the goals of this re-factoring project is to restructure the packaging. The following principles will guide this effort.

The first three package principles are about package cohesion, they tell us what to put inside packages:

 

REPThe Release Reuse Equivalency PrincipleThe granule of reuse is the granule of release.
CCPThe Common Closure PrincipleClasses that change together are packaged together.
CRPThe Common Reuse PrincipleClasses that are used together are packaged together.


The last three principles are about the couplings between packages, and talk about metrics that evaluate the package structure of a system.

ADPThe Acyclic Dependencies PrincipleThe dependency graph of packages must have no cycles.
SDPThe Stable Dependencies PrincipleDepend in the direction of stability.
SAPThe Stable Abstractions PrincipleAbstractness increases with stability.