Muddle-headed Kay (mhw) wrote,
Muddle-headed Kay

This journal has been placed in memorial status. New entries cannot be posted to it.

  • Mood:

A small rant

This is aimed at stupid programmers everywhere, but at one in particular: AAAAAAAAAAAAAAAAARGH!

Dear programmer,

I know that your time is highly precious. I also know that people write weak specifications. People coding to such specifications often make a crucial error: not compensating for that weakness.

When faced with something like "These color-maps are ASCII text files set up as a series of RGB triplet values (one triplet per line, encoded as the red, green, and blue [RGB] components of the color)" in a spec you have to be robust. From the paragraph after that, you know that the 'values' just mentioned are positive integers from zero to 255 inclusive. But that is all that you know. What separates the values? You don't know. It could be a space, or a tab, or a comma, or in fact anything that by definition can't be part of the next value. Yes, even a capital S or an exclamation mark or the word 'aardvark'. Anything other than one of the digits zero to nine, inclusive.

Yes, the specifiers were sloppy, and you weren't the person writing the spec. But you were sloppy, too. You see, other people have written .MAP files that supposedly conform to the spec, and they decided to use tab characters as separators. That shouldn't matter, because you are careful, thoughtful and a defensive coder, and so you used fgets() and sscanf() so you could be ultra-careful in parsing a .MAP file.

Oh. No, you didn't, because you're an idiot. Your software assumes that values are separated by spaces, AND BY NOTHING ELSE. I've tested it.

You could have spent a little more of your precious time thinking. You could have coded defensively, and not made simplistic assumptions. That way, I could have used your software with their files, and I'd have been happy.

Because I'm a nice guy, I'm not identifying you, or the people who wrote the spec; though it's possible people may be able to make informed guesses. And, because I'm a nice guy, I'm going to mail you a nice, non-ranty letter outlining the problem and suggesting a bugfix so that you can improve what should be a good piece of software.

But I tell you, if you'd handed in code like that for my Advanced Software course, you'd have got a big red F, and you'd have richly deserved it.

Tags: rant

  • Kay Dekker, 1959-2011

    I hope you've already heard this sad news, however I post here to reach those who have not heard. Kay Dekker died on the 7th July 2011, and was…

  • Thank you, and a bit of progress

    Thank you, everyone who sent messages of love and support. Very, very much appreciated, believe me! I saw Jerry, my GP, today about the mess of…

  • Easy caramelised onion and carrot chutney

    This recipe happened because of my friend Sue, who is also a volunteer at Willow View. She was enthusing to me about a sandwich that she'd had for…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.