Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Consider refactoring before taking a step to code rewriting:

Refactoring is only an option for anything but a trivial code base if a suite of automated tests have already been written.

The article makes no mention of tests. I suspect the reason is that there were none. Refactoring would most likely have been impossible until an automated test suite had been written.

Many developers are confused about the purpose of an automated test suite. It's not to make your designs better. It's to allow you to refactor the spaghetti that will inevitably arise.



The article is not about refactoring. It's about rewriting the software. So that's why I didn't mention about refactoring in details. Automated testing is part of the refactoring. You will change a small amount of code then run tests to see it works as expected. This is how refactoring works. No need to mention abou that.


That is just not true. There’s always the option of refactoring, make the necessary changes and manually test the system. Even though I’m a big fan of automated testing (not only unit tests), most codebases don’t have complete test coverage, but we still refactor and change the systems.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: