It looks like the judge's choice for the contest winner was the most "believable" entry; it contains code that is strange, but strange in a way that you might actually see in a real project. Perhaps I overshot the mark then. My entry was pervertedly clever, but was a little too strange to be believable. I didn't expect to get the "crowd favorite" award either; that clearly belonged to the OMGOCR calculator. But last I checked, my entry was doing 1 percent worse on the polls than the votes for "None of the above!"
Despite the fact that Alex gave my entry a great write-up, there was quite a bit of material I wrote to him that he had to leave out of his article due to space limitations, and I've obtained his permission to post that material here. (Alex Papadimoulis is editor of www.worsethanfailure.com, the site which held the contest.) I've been too busy to blog for several weeks, but with the contest getting over, I figured I'd better make it snappy with this post before it became old news. Here is the full text of the conversation I had with Alex about my contest entry:
• Where did you grow up and where do you live now? Anything fun/interesting about these locations? Do you have any kids, family, etc?
When I was twelve, my parents moved for the last time. My father got a settlement on his social security disability and bought a tiny house in a very small town in rural western Oklahoma. After a lifetime of wanderlust, he is content to never move again. I emphasize with him; I too am sick to death of moving. But my journey is just beginning.
I could not stay in that small town. If you live in western Oklahoma, you will be a farmer, or a rancher, or work in the oil fields. There was no place for me there. When I was seventeen I joined the Marines for no other reason than to get away from the life I felt trapped in. I did not believe I would ever go to college. Growing up in a family with no money, I was raised to believe that it just wasn't in the cards for me.
I became a Small Computer Systems Specialist in the Marine Corps. I went to school in California and was stationed in Washington, D.C. (I loved D.C!) Working alongside civilians, I came to realize that the only difference between their opportunities and mine was the degree. I liked my job, working with computers, but I did not take well to military life. I also really wanted to be a programmer, but my duties only included network administration. If I went back to school, I could do what I really wanted to do, and be a civilian.
I could have gotten a tuition scholarship on academic merit without having to join the military, but that would not provide money to live on. After I got my honorable discharge, the G.I. Bill money enabled me go to college. I chose a small college (Southwestern Oklahoma State University) because it was close to where my family lives. Since then I've been blessed by many great opportunities. I got an internship writing business software, a summer fellowship doing undergraduate research in machine learning and robotics, and most recently I became the first student from a regional university to get a NASA internship. I also met the love of my life, Melissa, in college. We will be married next year, after I graduate. For the moment I'm living in Norman, Oklahoma, finishing the second summer of my undergraduate research program at the OU.
• When and why did you get into the field of computer programming? What college/university did you attend (if any)?
It wasn't until I was twelve that I got my own computer. Someone gave me an Epson QX-10, which was an old 8-bit Z80 machine with 256K of RAM. It was older than DOS; instead, it ran CP/M. To put this in perspective, I was running CP/M on a Z80 while my schoolmates were running Windows 95 on 586 Pentiums. My cousin asked me if my computer was a dinosaur; I told her that it wasn't even that evolved, "more like a trilobyte computer!" I loved it though.
(This topic parallels something I recently wrote in my blog: http://dennisferron.blogspot
Most people get their start in programming by learning BASIC. I've never met anyone else who learned to program in dBASE II. Unlike most 8 bit computers, my Epson did not come with BASIC. It did come with a scattering of business software disks, including the dBASE programmable database software, and a slim, friendly introduction to programming in dBASE script. We're talking a book less than 100 pages and a language that only let you have 80 integer variables - that's all I got. But it rocked my world. As I read about if-statements and loops and variable assignments, I did not so much learn the material as experience divine revelation. I wanted to shout it from the rooftops. I would read about an algorithm and shout, "Aha! Of course! THAT'S how it's done!" Everyone thought I was nuts.
There was literally not a single soul in my small school who was interested in programming, besides me. I learned to rely on myself to overcome problems and answer questions, because there just wasn't anyone else around to ask. You learn to be resourceful that way; a child can shirk responsibilty for hard problems onto the shoulders of an authority figure, but when it came to computers I was the highest authority I had. So if I ran into something I didn't understand how to fix, I went at it like a dog with a bone until I figured it out myself.
dBASE was ultimately too limiting a programming environment to write games on. Just as I was nearing the end of what I could do with dBASE, my uncle built me a 486 machine with Win95 to replace my Epson CP/M machine. On the Windows 95 CD, tucked away in an obscure folder, I found my next great love: QBASIC. If I could not get my friends interested in programming itself, I could get them interested in the games that can be written in QBASIC. It was shortly after discovering QBASIC on my own machine that the realization hit me that not only were the Gorillas and Nibbles games on the school computers written in QBASIC, they came in source code form. I spent countless hours at school hacking those two games which came on the school computers, and my friends actually enjoyed watching me program. I learned the uncommon skill of entertaining an audience while programming, which is something that has helped me immensely whenever I have given code reviews in my professional life today. I also learned to program while explain what I was doing to someone watching over my shoulder, and still to this day I write code as though I have someone watching, trying to understand what I am doing.
Since then I've had a passion for learning every computer language I can. I'm now studying for a bachelor's in Computer Science at Southwestern Oklahoma State University. At the risk of upsetting my professors, I have to say I haven't really learned anything in class that I hadn't already picked up before I came here. But what I have had is the wonderful opportunity to do internships and participate in research activities, and it was through my university that I was enabled to do this. And furthermore I stress the words in class because while I get nothing out of lectures, I have had classes which featured projects we had to do, and I certainly learned things after class while doing those projects.
• What is your job title and where do you work? How long have you been there?
• How long have you been a reader of WTF? Have a favorite article/story? Submit any?
I've never submitted an article, but I've been a long time reader of the site. I seriously thought about submitting this story: a coworker of mine designed a new user interface for submitting data in a grid (a problem which has obviously never been solved before). The grid featured different colors for validated rows depending upon whether they were new, old, canceled, or "uncanceled". (The system had appointments you could cancel or undo cancellation on.) If you hit "OK," the form saves the data. If you hit "Cancel" he wanted it to ask, "Are you sure?" Apparently it was tongue-twister Friday that week because he came up with a slightly different way of phrasing the question. Here's the message box the application brings up if you hit cancel: "The rows which were uncancelled that are now cancelled are highlighted in white. The rows which were cancelled that are now uncancelled are now highlighted in gray. Are you sure you want to cancel the uncancelled rows and/or uncancel the cancelled rows?"
He couldn't understand what I found wrong with that. I told him to say it three times fast.
• What drew you to the OMGWTF contest?
• How did you come up with the idea?
When I saw the calculator contest, I realized it would be fun to try to simulate this situation in C++. Of course the trouble is that under normal circumstances the "petrified values" language I described wouldn't actually be useful. However, for some time I have been aware of the concept of template metaprograms in C++. See, it turns out that C++ templates are so complex that they are actually Turing complete! They can be used as a pure functional, recursive language that "runs" at compile time. Since templates act on types, it should be possible to write C++ templates which perform recursive programmatic functions on types. Instead of passing the value 2 to a normal function, I pass the type Two to a C++ template.
Which brings me to my next point. Although I didn't actually have to use any true template metaprograms in my code (my templates are similar to metaprograms, but not really), when I found out that template metaprograms were possible in C++, it brought a startling and abrupt end to my love affair with C++. You see, the cardinal rule of good software design is to implement the same feature only once. Once I learned of the existence of template metaprograms, I understood that C++ implements two Turing-complete languages. One language runs at run time (normal C++), and it is classified as an imperative language. The other language, templates, runs at compile time but is a pure functional language. Though they are locked in a perverse embrace, the two languages could not be more different from one another. It begs the question, why would you have one language that runs one time only (templates that run at compile time), and another language whose code runs every time? That was how I came to understand that templates are just a poor work-around for the real underlying problem: you only need templates because the static typing is too limiting. A language which uses dynamic types does not need templates because you can do operations on types at run time with the same language you use for other problems.
I could go on but I'll suffice it to say that I designed the calculator to be an example of what I think it wrong with inheritance and static typing, and I also wanted to push the boundaries of what is possible with the C++ language. For instance, in the project I actually invented a new kind of method dispatch which selects base functions by namespace with the aid of templates.
• How long did it take for you to develop?
Me: "Um, it's supposed to be a scheduler, right?"
Boss: "Sure!"
Me: "Well, I don't see any calendar in here, or any code that has to do with calendars or appointments..."
Boss: "Oh, I had them do administrative and maintenance forms until you got here. You know, all the icky support stuff. Don't worry! I have faith in you!"
Two weeks to go and the application had not one line of code that actually dealt with what the app was supposed to do! Egads. In two weeks - I had it done. Didn't sleep for days and my girlfriend thought I disappeared from the Earth, but I shipped it, baby!
(This is the same place I worked where I picked up the moniker Steely Eyed Code Slinger, which I used as the name of my blog. I talk more about what that means in this entry: http://dennisferron.blogspot
• Were you inspired by any WTFs that you encountered in your professional programming?
That does not, however, mean that you can't do badly in every possible facet. My use of classes was narrow and deep (deep inheritance, but few classes at each level). His use of classes was broad and shallow (short inheritance, many classes at a level). The architecture of my calculator takes the worst of both our methods - it uses many more different classes than it should and inherits as deeply as possible. Instead of 1 x Height or Width x 1, a structure that is both deep and broad results a Height x Width rectangle! According to the garbage collector inside the calculator program, instantiating an object of type NinetyNine results in the instantiation of about 2700 other objects.
• What challenges did you face in creating your solution?
• Would you replace calc.exe on Windows with your calculator?
P.S. Let me know if you'd like a WTF sticker.