How to make fewer mistakes.
How to make fewer mistakes.
21–30 of 75 posts
How to make fewer mistakes.
How to make fewer mistakes.
This may not be what you want to hear. Making mistakes properly is progress. Make the exact same mistake multiple times? You might need to write them down as you find them. At one startup we had a motto: Measure once, cut twice. Being fix the bug, then write code to mitigate that risk in the future. Fix it twice. Now in critical systems like traffic lights and the like, mistakes kill people, so you test the everlovin…
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 can I limit and validate parameters most efficiently?
More info here: https://henrikwarne.com/2016/04/28/learning-from-your-bugs/
and here: https://henrikwarne.com/2016/06/16/18-lessons-from-13-years-...
If it comes to it write two solutions (possibly one optimized, one not) that solve the same problem in different ways, and confirm the results against each other.
Don’t count on just picking good edge cases.
When 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…
Most of my code reading is in my editor. I'm in a certain mode of thought there, mostly detail-oriented as I piece things together. When committing code, I use git diff to inspect everything going into the commit, making sure I agree with it. I do this in a terminal (I don't use a terminal-based editor) with a different color scheme. Lastly, I'll re-read it again (especially if I'm not 100% sure) on a web-based git server (Github/Gitlab) as a way to get some closure on the day/commit.
This works well for me because:
* Most committed code is read at least twice
* Each reading context is different, at least visually
* Time passes between each reading, which gives your brain space to surface doubts
Doubt is your friend here. With enough experience, you'll know when you've nailed something.