Hacker News new | ask | show | jobs
by twblalock 2383 days ago
> I usually take 3-4 tries with some significant amount of testing to get my code to a working state.

This is probably the biggest problem. You are thrashing on a cycle of testing because your code didn't work properly the first time. Getting it right the first time, even if it feels slow, is usually faster than fixing it later.

In my experience this is what happens when developers focus on the "happy path", i.e. spending most of your time assuming your code will run in a perfect world, and writing tests to prove it.

You may want to try working backwards from the tests -- decide how your code should behave, especially in bad situations where inputs are null or your dependencies throw exceptions or your API calls fail. Write the tests, and then fix your code to make the tests pass. Use coverage tooling to make sure you covered what you thought you did.

If you still have problems, try asking some of your colleagues to spend half an hour with you to review your code before you submit it for review. Some of them will probably be happy to help the new guy, especially if you are trying to do a better job meeting their expectations.

1 comments

"slow is smooth, smooth is quick" - always loved this quote.

this. Think more, type less.

Go for a walk/run and think about the problem, draw it out in your head and play around with different options. Then start typing.