On the soapbox
2,030
6
Advertisement
As you may or may not know, in addition to being a moderator, I'm also one of the editors for gamedev.net. (Though if you've received a rejection from us in the past year or so, chances are I'm the one who wrote it.) One thing I've noticed, not just in the articles gamedev receives (though it's one of those that prompted this rant) but in articles published on the internet on the whole, is the general lack of error handling or even detection code in article source code. Often this is in the cause of "clarity" or some such other worthy cause.
Today I wish to say: "Well, screw that."
I feel like entire generations of coders are growing up not knowing how to deal with error conditions because they're constantly learning from sources that don't acknowledge that network failures occur or that you occasionally receive bad input from the user. (Or if you're a compiler writer, you constantly receive bad input from the user, but I digress.)
So leave it in. If you're writing exception safe code, say which guarantee that your functions give. Check those return values. Go ahead and call GetLastError(). Throw those exceptions and make those assertions.
Despite our best efforts to the contrary, people still are learning programming by imitation. We can't stop that, but we can at least give them good code to imitate.
Today I wish to say: "Well, screw that."
I feel like entire generations of coders are growing up not knowing how to deal with error conditions because they're constantly learning from sources that don't acknowledge that network failures occur or that you occasionally receive bad input from the user. (Or if you're a compiler writer, you constantly receive bad input from the user, but I digress.)
So leave it in. If you're writing exception safe code, say which guarantee that your functions give. Check those return values. Go ahead and call GetLastError(). Throw those exceptions and make those assertions.
Despite our best efforts to the contrary, people still are learning programming by imitation. We can't stop that, but we can at least give them good code to imitate.
Advertisement
Advertisement
Advertisement
Discussion