Your App Will Eventually Be a Legacy App

I just spent an hour debugging a problem with an aging legacy system for my job and other thirty minutes fixing the problem and cleaning up the mess after all that debugging. A MySQL mediumint auto_increment key had overflowed on a very central and very important table, leading to very cryptic user-land errors. The debugging process could have been much shorter if only the original app developer had put proper error checking in place.

The moral of this tale is that you should always put proper error handling in your code. Both your users and the poor devs who come after you will be grateful. Also, if you think to yourself, “This app won’t be in use when this becomes a problem,” you’re probably wrong.