I came across this succinct
definition of what constitutes a "Bad Design" in software:
- 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).
Surprisingly, software having these traits are very difficult or even impossible to be unit tested. Hence unit test is often used to a gauge of these bad traits. Don't believe, try it.
Actually, I don't consider it surprising at all that software with such traits is difficult to test.
ReplyDeletePoints 1 & 2 already imply that a 'small' test will have many side-effects meaning it's not so small any more.
Continuing with 3, you can't disentangle a small piece to be tested. If you try make some changes to obtain a testable piece, you suffer the consequences of 1 & 2.