Given that working features are better value for a company than good code at any given point in time and that bad code makes adding more features difficult:
How do you stop the code from deteriorating over time?
At any point, getting a feature to work is higher priority than getting it to work with well engineered code which takes longer. Even though as time goes on the effort for each feature increases.
How do you stop the code turning into an un-maintainable mush over time?
A comprehensive set of unit tests
edit: and it's helpful if they are well written to accurately test all your classes / interfaces in a human readable way.
edit 2: as svelil says, refactor your code to keep it clean, but being able to do this is a consequence of having the unit tests.
Unit tests will not stop the rot on their own. I can still write horrendous, unmaintainable code that passes a unit test.
A better answer is unit tests. + regular refactoring + peer review (either at pairing stage or after) + standards
You do know there is no silver bullet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With