Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stopping code rot [closed]

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?

like image 246
Jeremy French Avatar asked Jan 20 '09 13:01

Jeremy French


2 Answers

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.

like image 56
DanSingerman Avatar answered Oct 24 '22 14:10

DanSingerman


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.

like image 22
Johnno Nolan Avatar answered Oct 24 '22 14:10

Johnno Nolan