We all make mistakes now and again, so it’d be helpful to make a list of things other programmers should avoid. One of the lessons we learned the hard way was not to change too many things before coming to a stable point you can test.
- Sort of like you said, “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” I know it’s a pain to crawl through your code, but your future self will thank you.
- Please avoid writing an algorithm with a data set, find new data that is different from current and write an if statement to handle it. It’s fine the first time you do it, but the more errors you find and deal with this way, the more difficult your end code will be to actually read.
- Make comments throughout! Even if you don’t think it’s necessary. Chances are you’ll have to go back through it eventually and you’ll save yourself the trouble of figuring out what’s going on.
- Giving obscure names to your variables. Sure you might know what it means in this moment, but what happens if you need to come back to it later? It’s probably going to make zero sense and a whole lot of frustrations.