Design principles represent guidelines for development that help in avoiding poor quality software composition.
Robert Martin provides strong guidance as to best practice in his book Agile Software Development. He holds that good principles guide the developer away from bad design, which believes to feature three main characteristics:
- Rigidity, which makes maintenance and extension difficult as changes to one part of the system affect others.
- Fragility, where changes to one part of the system bring unexpected consequences to others and so increase development time and risk.
- Immobility, where code is so entangled within its current area of use that it cannot be easily reused elsewhere.
The principles are grouped into three areas, each concerned with a different level of abstraction and represented by an acronym: SOLID; RCC; and ASS.
Whilst these principles are a great foundation they are not alone, sitting alongside – and sometimes against – others.
|Law of Demeter||One component should know as little as possible about others with which it interacts.|
|Don't Repeat Yourself||Don't write code again when the original can be effectively re-used!|
|You Ain't Gonna Need It||Write the least code necessary in order to get the job done.|