You mind find this interesting: https://routley.io/tech/2017/11/23/logbook.html
Ask HN: How to make fewer mistakes?
51–60 of 75 posts
Re: Ask HN: How to make fewer mistakes?
#52Gary Klein wrote a great book about how to learn from experience, based on research in naturalistic decision making, kinda stuff firefighters and NICU nurses do, but also e.g. design engineers for many decisions ( https://www.amazon.com/Power-Intuition-Feelings-Better-Decis... ). His advice for learning from mistakes is basically to look for the cues or patterns you missed that caused your mistake. That way you find…
"write readable code." I think it doesn't matter if you give the source code or not, but you should allways "write readable code". Sure there is a difference between throw away code and a library, but also for youself it is a good habit to understand later, what you have been doing. And so much more for other people ...
On the other hand, it's worth digging deeper.
A lot of programming advice is these rules of thumb, and they're mostly good, but they're motivated by underlying principles (which you explain in this particular case). So it's useful to not just have these rules of thumbs, but also to dig deeper and look for underlying motivations.
Re: Ask HN: How to make fewer mistakes?
#53Re: Ask HN: How to make fewer mistakes?
#54When I was getting my pilot's license, multiple times I started up without unchaining the tail. I joked about it with another instructor, and he basically said that it had literally never happened to him and that I should be doing a final walk around. I'd done even more embarrassing things, sitting at the runway ready to go and the tower tells me my baggage door is open. Since making that final walk around a habit, n…
Changing your mindset is another good piece of advice. When you're done coding, stop thinking like a programmer and think like a user - a bored, fed-up, malicious user who's going to have a go at breaking your software. He's not going to do the things you expect him to, he's going to try to enter ridiculous data, in the wrong order, press stuff that he shouldn't, etc. Be curious. "I wonder what happens if I do this..."
Offer to buy a beer for every bug your colleague finds in your code. Don't want to pay out? Make it hard for him to find any, and any that he does find will be well worth the cost.
I've been coding for nearly 40 years and still manage to write some crap on occasion!
Re: Ask HN: How to make fewer mistakes?
#55You say that "there is always a corner case that i don't think about or some test that is trivial to the QA team but i didn't do, and my code end up being broke". Is the corner case that you missed a technical issue or is it that the QA team has a better understanding of the business problem that is being solved and that hasn't been translated into a requirement/user story that you would even know to code against.
Re: Ask HN: How to make fewer mistakes?
#56I think it's something you learn the more experience you have. I think the more mistakes, errors and bugs you see through your career, the better you get at recognizing pitfalls when you write code. Also, I'm a big fan of and practice "defensive" programming. There's lots of articles written about that, but in short it kind of changes your mindset a little and steers it towards more robust code. What can fail? How ca…
Mixing the three is bad.
Re: Ask HN: How to make fewer mistakes?
#571. run the code through a debugger as soon as you finish it; 2. run the code and purposely try to break it with all the edge cases you can think of; 3. run the code as if you are an end user who knows absolutely nothing about it; 4. have your colleagues try to break your code before you commit it. https://wiki.illumos.org/display/illumos/On+the+Quality+Deat... https://davepacheco.github.io/se411/release/fcs-quality-a…
2. And 3. Does not help when you miss the edge cases.
4. It's called code review.
And my own: run the logic through an automated theorem prover, for example Isabelle. They will instantly tell you if any invariant causes a contradiction (mistake, corner case) or it cannot deduce behaviour given prerequisites. (missing specification, probably corner case)
Since it makes you write and read the code twice and forces you to think of it as necessary conditions and invariants, that alone might help.
Re: Ask HN: How to make fewer mistakes?
#58If you aren't embarrassed by the code you wrote 6 months ago, you haven't progressed enough.
Does that actually happen for really senior developers though?
Re: Ask HN: How to make fewer mistakes?
#59Re: Ask HN: How to make fewer mistakes?
#60Earlier quoted context omitted.
Hands down the best book. Plus the authors are really nice guys! http://www.growing-object-oriented-software.com
I challenge your best book with the book of Kent Beck (founder of TDD) https://www.amazon.co.uk/Test-Driven-Development-Addison-Wes...