What is entropy? It’s a term borrowed from physics representing a measure of disorder. This is relevant to software because whilst measuring disorder in a software system is arguably subjective, entropy is obvious when it impairs a systems purpose; to deliver value to the organisation.
In software, entropy is something we want to manage. Managing entropy allows us to provide business value. If we can mitigate the disorder by continually addressing it we reduce the likelihood of those issues cascading into larger, difficult to manage issues. If an issue is too large to address immediately consider an alternative corrective action, perhaps additional logging, a compiler warning, throwing an exception or just simply documenting for further discussion?
In managing entropy the system life span will increase and reduce the cost of change, the system can remain an asset to the business as opposed to a liability. If a team is working on an intuitive code base that reflects the problem domain it is easier to comprehend, test, refactor, add new features and is heuristic, allowing the team to build domain knowledge. A cycle of continuous improvement manifested as the system.
So, how do we manage entropy? By adopting discipline, vigilance, tests and treating refactoring as a permanent, inclusive, characteristic when delivering tasks. The cost and ease of refactoring is lowered with testing because of the confidence to enact change without introducing new bugs. The original Pragmatic Programmer book cites Broken Windows as an excellent analogy, attending to social disorder by fixing comparably innocuous broken windows in New York City set a standard for neighbourhoods, reducing the escalation to serious crime. Other developers adopt the Boy Scout Rule - “Always leave the camp site cleaner than you found it” meaning to address disorder as you find it.
Dogmatically refactoring all code considered poorly factored may be of benefit for the health of a system, but not always for the business. Not all systems offer the same value to a business. Conversely businesses change focus, it is important to ensure that entropy is managed so systems can respond to business change competitively. Striking the balance is a never ending task and highlights the importance of regular dialogue between all stakeholders.
Avoid nasty surprises. Manage entropy.