The most common criterion that I have seen used is the TNTWIWHDI or “That’s not the way I would have done it” criterion.
But there is one set of criteria that I think all engineers will agree with. A piece of software that fulfills its requirements and yet exhibits any or all of the following three traits has a bad design.
- It is hard to change because every change affects too many other parts of the system.
(Rigidity) - When you make a change, unexpected parts of the system break.
(Fragility) - It is hard to reuse in another application because it cannot be disentangled from the current application.
(Immobility)
Moreover, it would be difficult to demonstrate that a piece of software that exhibits none of those traits, i.e. it is flexible, robust, and reusable, and that also fulfills all its requirements, has a bad design. Thus, we can use these three traits as a way to unambiguously decide if a design is “good” or “bad”.
Quelle: Robert C. Martin, http://www.objectmentor.com/resources/articles/dip.pdf