Bad Code Can Lead to Good Code

Bad code can sometime be used in certain scenarios. You can avoid principles just because a principle is just in principle.

It stays in your code as a marker for you to remind you to change it later. Will it be changed ever? Only time can tell. So bad code also might live a good life - as long as it works.

Its a Code Smell and that's good because it keeps you looking for abstraction that you have missed. But meanwhile, you can still provide value to your stakeholder.

I imagine rules like this one defining a landscape, where maintainable code lives in the valleys. As you add new behaviour, it's like rain landing on your code. Initially you put it wherever it lands.. then you refactor to allow the forces of good design to push the behaviour around until it all ends up in the valleys.

References

Nigel Thorne's answer to How to Unit Test Abstract Classes?


Backlinks