Geek story hour: Parser of death
simont.livejournal.com
simont.livejournal.com
Classic.
If it did the job, it's already ahead of a lot of code out there. Sure, the code was bad and not thought through.
That's kind of how I code when I don't care and need a quick workaround :-)
It takes special people to write beautiful code 100% of the time.
Ugly code can be written slowly too...
I can even speak from experience on that. In my internship during my first year of university, I found myself wanting to write a little parser to read config files for my program. It would have been something like "double myvalue = 42\nint myotherval = 20" etc. I figured this should be a very common problem, since so many programs use this kind of configuration. Googling it let me find even better, cross-platform config libraries which use the registry on windows or config files on other platforms, and saved me from writing the parser in the first place.
Intolerance for egregious unprofessionalism and incompetence is not exactly something our field suffers due to an excess of.
I've done this kind of thing more than once, even back when I was fairly junior as a programmer.
Now I know about lex and yacc and I know what a parser really is. If everybody at the company was a bunch of random engineers or something with no experience with language design or parsers, its totally understandable that something like that could happen.
"The language contained an operator ITEM n OF s, which would return the nth word of the string s. (Yes, that was a basic operator in the expression language; a function call syntax or a separate standard library would certainly have been well beyond the programmer's mental horizon.) But you could also alter the implicit use of whitespace as the ‘word’ separator, by writing ITEM n OF s SEPARATED BY d; this would allow you to, say, fetch the third field of a colon-delimited line. So far, nothing too out of the ordinary – except that one now naturally wonders which way ITEM a OF ITEM b OF c SEPARATED BY d would bracket, since it's exactly isomorphic to the well-known if–else ambiguity."
Deleted comment
Also, when did it become wrong to point out people's stupidity when they do something as utterly stupid as (quite clearly) demonstrated in the article?
By the way, Simon's a top bloke with a really, really dry sense of humour. I'm wondering how much is being lost in cultural translation here.
Ok, I'd hire him straight away after that, so things would work out well for everyone!