When I encounter a bug I write an assert that reveals the problem before I fix it in order to prevent having to deal with the same issue more than once. This is especially big for me since I work with a lot of (other people's) data.
Ask HN: How to reduce sloppy mistakes?
31–40 of 40 posts
Re: Ask HN: How to reduce sloppy mistakes?
#32Speculation: Based on the principal that you can't improve what you don't measure (or, what you measure you improve), you could keep a log of the sloppy mistakes you make. After a while, maybe patterns will emerge and you can attack 'mistyping numbers' separately from 'missing cases in a switch block' and 'correct behaviour of nested-if took 5 attempts'.
Re: Ask HN: How to reduce sloppy mistakes?
#33Re: Ask HN: How to reduce sloppy mistakes?
#34Using a statically typed language might also help, as the compiler can catch a lot of really stupid errors.
Re: Ask HN: How to reduce sloppy mistakes?
#35It's a bit like the integrity mechanism of developing two copies of the same software, done by totally separate teams. You and your friend are both thinking about how to solve the problem, but separately, which means the likelihood that both of you make the same dumb mistake is fairly low.
Re: Ask HN: How to reduce sloppy mistakes?
#36I know what you mean about hitting F5 all the time. I usually program that way when I don't feel like thinking. I want to cross my fingers and hope that it works. When I notice I'm doing this, I need to stop and think about what it is that I'm doing. I'll often write down in text what I'm trying to do. Or I'll turn off the computer and think about it.
Re: Ask HN: How to reduce sloppy mistakes?
#37Re: Ask HN: How to reduce sloppy mistakes?
#38- When I'm working with a fast compiler, I setup a small CI system to immediately compile my code and run my tests every time I save my changes. If I can't do this for some reason then I setup a trivial background script to do this constantly and watch the output in another window.
- I try not to cut corners. It's easy to stay in the flow once I have things setup so that I can build and extend my tests and scaffolds along with my code.
Small moves, Everest, small moves...
Re: Ask HN: How to reduce sloppy mistakes?
#39...the number of sloppy mistakes I make is still way too high... Compared to what? You may not have a problem. Sometimes "code, mistake, fix, code, mistake, fix, code, mistake, fix,..." is faster than "code it perfectly once". For me it usually is. I'd rather crank stuff out quickly and fix it than drive myself nuts thinking it through. Stupid syntax and typing errors will go away with repetition. Otherwise I wouldn'…
Re: Ask HN: How to reduce sloppy mistakes?
#40It's ok if you don't get it perfect all of the time. It's the 20 minutes debugging that's killing you. Shorten your cycle and eventually you will get less sloppy (or immediately know where/what the sloppiness is before you even run). It will be like that typo you "know" you made even before you finished typing (something won't feel right and you'll go back and fix it before you read the debugging output).