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

I have always considered refactoring as improving your current code rather than starting from scratch. I like to start over once I have a working approach for two reasons:

1. The original code is by that time I have finished hacking a mess and it is not a good place to start.

2. I can use the original code and the new code to find bugs I missed the first time around. A good percentage of the time I find bugs in my original code that only a clean rewrite exposes.



That's perfectly valid. In fact I did a re-write of a favorite code, a few weeks ago. It's something a colleague and I are working on, and I explained to him that I no longer trusted the old code because it was such a mess.

Also, I try to incorporate new techniques that I've learned when I write new code.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: