Hacker News new | ask | show | jobs
by mkramlich 5766 days ago
Rough rule of thumb that works wonders:

Write/modify code.

Run program and/or ensure that codepath is executed.

Did it do what you intended?

If yes, figure out what's wrong about it, fix it, retry.

If no, move on to next item on your agenda. (Possibly first doing a quick refactor to improve readability, etc.)

1 comments

If you refactor you should always retest. I've lost track of the number of times things have been broken by someone tweaking things to make them better.
The flip side of this is that you can do deep refactoring with more confidence if you have thorough test coverage (and/or a smart type system).