The Do’s of programming. My favorite “code” improving keywords are:
# final
: makes sure I don’t do stupid assignments, in combination with the compiler warnings “this variable may not have been assigned” a very valuable tool
# finally
: close files, connections and clean up despite errors happening!
# throw
(note: not throws!): exception handling, my last code review put me onto improving that
# assert
: to keep myself from the most stupid things that could have happened
# else
: if there is an if there should also be an else, just as with switch there should be a default.
in no particular order. When I am forcing myself to use those frequently the code becomes a lot safer and these are easily remembered. Any others?
Next: the Don’t’s of Programming 😉 (or whenever I get to that).