What is Bad Design
From CSSEMediaWiki
(Difference between revisions)
(New page: == Introduction == Software engineers often are unhappy with the designs of their peers. If you ask them to articulate exactly what is wrong they will often respond by saying '''TNTWIWHD...) |
|||
Line 6: | Line 6: | ||
This response does not answer the question, it only indicate that someone thinks they have a better solution. So then the question is what is it about their solution that is better - or to rephrase the question, what is it that makes the first design bad? | This response does not answer the question, it only indicate that someone thinks they have a better solution. So then the question is what is it about their solution that is better - or to rephrase the question, what is it that makes the first design bad? | ||
− | == | + | == Bob Martin's View == |
[[Bob Martin]] has suggested the following three criteria for bad design, | [[Bob Martin]] has suggested the following three criteria for bad design, |
Revision as of 11:07, 28 July 2009
Introduction
Software engineers often are unhappy with the designs of their peers. If you ask them to articulate exactly what is wrong they will often respond by saying TNTWIWHDI (Thats not the way I would have done it).
This response does not answer the question, it only indicate that someone thinks they have a better solution. So then the question is what is it about their solution that is better - or to rephrase the question, what is it that makes the first design bad?
Bob Martin's View
Bob Martin has suggested the following three criteria for 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)
He goes on to say,
What is it that makes a design rigid, fragile and immobile? It is the interdependence of the modules within that design. A design is rigid if it cannot be easily changed. Such rigidity is due to the fact that a single change to heavily interdependent software begins a cascade of changes in dependent modules... ...Fragility is the tendency of a program to break in many places when a single change is made. Often the new problems are in areas that have no conceptual relationship with the area that was changed... Simple changes to one part of the application lead to failures in other parts that appear to be completely unrelated. Fixing those problems leads to even more problems, and the maintenance process begins to resemble a dog chasing its tail. A design is immobile when the desirable parts of the design are highly dependent upon other details that are not desired... ...In most cases, such designs are not reused because the cost of the separation is deemed to be higher than the cost of redevelopment of the design.[1]