The codebase of a subsystem or maybe the whole system has turned into a big ball of mud. It’s claimed too brittle, too complex and too costly to continue developing. It’s at this point that a grand rewrite is proposed accompanied by statements of how things will be different:

  • We’ll eliminate static wiring using Spring
  • We’ll model everything as a service
  • We’ll adopt test-driven development and make use of jMock
  • We’ll build everything using a RESTful approach
  • We’ll avoid using RPC in favour of messaging
  • …….

Things will be so much better in this brave new world but……they won’t. The reason the codebase has got into a mess is because we failed to execute on important principles such as:

  1. Take account of coupling and cohesion.
  2. Be clear about people’s roles and responsibilities to avoid unqualified or inappropriate decision making.
  3. Clarity and simplicity of roles and responsibilities in design elements.
  4. Maintain modular, well-isolated code and conceptual integrity.
  5. Avoid shared data-schemas or integration via the database.
  6. Make the software testable and maintain the tests.
  7. Select technology based on appropriate design work.
  8. No broken windows.
  9. Track and maintain appropriate metrics.
  10. Review projects to identify and disseminate useful lessons to developers, architects and customers.
  11. Account for the operational aspects of our software in requirements and design.
  12. Review to ensure code aligns with appropriate design principles.
  13. Surface, balance and mitigate risks.

It’s these principles and others that enable superior engineering which in turn delivers a good-quality, maintainable codebase. Any rewrite will end up a ball of mud just like it’s predecessor unless the style of engineering is adapted to incorporate principles such as these.

Some propose that frameworks can prevent mistakes, ensure a quality design and deliver testable code. I think experience suggests otherwise as we routinely (by accident or design) bend frameworks to fit some problem they weren’t really designed for leading to ugly, broken, poorly designed, brittle code. What would stop us doing it with new frameworks delivered as part of a grand re-write?

Should we successfully revise our engineering practices would we then have sufficient leverage to restructure our ball of mud into something nicer to work with? Maybe, maybe not but we might be better equipped to answer the question: re-write or re-factor?

  • Share/Bookmark

Comments are closed.