One of the things I used to enjoy about coding was removing “crutches”. Allow me to explain.
Crutches are constants you use to put together a working demo. At some point, these constants need to be replaced with real data, loaded at run-time and editable outside the code.
I’ve just got rid of the first of the crutches. And those were the room width, depth and height constants, which are now being read out of an XML file. I’m also being sensible and sending more status output to the debug console. When I used to code in the early to mid 90s, I got my team to use an awful lot of assertions. I’m not sure how I feel about those, or exceptions now. It’s probably useful (I learned the method from McConnell’s seminal “Writing Solid Code” of course). Assertions really do make the code look a mess, but they are very useful and catch a lot of bugs.
What methods do you use nowadays to code defensively?