Keeping code manageable and testable requires the discipline and foresight to apply principles and maintain habits that have little or no apparent effect at the point in time when we make decisions. 1/
We all recognize code that we regard as a mess. But why is that way? What was the one decision we could have made that would have prevented it? There almost certainly was none. 2/
This why we can recognize a mess but given the chance to start over we end up making the same mess or a similar one. How can we avoid repeating our mistakes if we don't understand what they were? 3/
I suspect that we sometimes minimize principles and practices because as we're making small decisions to follow them or not, it doesn't look like they will make any difference. 4/
By themselves those decisions don't make much difference. That is why our ability to recognize deferred, cumulative cause and effect is critical. We cannot arrive at a long-term goal without recognizing the short-term decisions that lead to it. 5/
One way to increase our understanding: Don't just look at code an call it a "mess" or "bad code." Try to read from it the tiny decisions that if made differently, would have made it just a little bit easier to work with. 6/
That recognition only helps us if we can express it in more general terms that we can apply to future decisions.
Maybe we'll come up with something new, but we'll probably discover that those expressions already exist. They're in books and blog posts. 7/
Maybe we'll come up with something new, but we'll probably discover that those expressions already exist. They're in books and blog posts. 7/
They're in SOLID. They're in Code Complete. That's what all those principles and practices are. They're not manufactured from thin air. They are lessons learned from past mistakes and expressed in a generalized way so that we can use them to improve future decisions. 8/
If we could discover them on our own, they would be letters from our smarter future selves to our current selves, saying, "Do this. I know it doesn't look like it matters. But I've seen what the future looks like otherwise." 9/
If we can't describe in specific terms what would help us to avoid repeating past experiences, can we even claim to have experience? Are we learning? 10/
Don't minimize principles and practices. They are how we accumulate knowledge and receive it from others. That doesn't mean we need to obey anything subserviently. Understand it. Argue with it. Improve it. But whatever you do, don't ignore it. 11/11