07 August 2014

Succulently bad

Today's post at The Daily WTF is in the CodeSOD category, but it's so gloriously bad that it's a candidate for CodeSOM, probably CodeSOY. The method in the snippet is attempting to detect whether a string contains a vowel, something that could be done with a regex in a line or two. Instead, after 73 lines of flailing about (including gormless multiline comments), HasAVowel() looks at only the first character of the string and returns the answers "yes," "no," or (!) "maybe."

Just one of the priceless comments:

    //because visual studio has put a red zigzag underneath the name of my procedure 
    //I need to return something always

We're in Leonard Pinth-Garnell territory here. Or, as my theater colleague Tim would say, "bad, bad, bad, and ghastly."

No comments: