The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

The OMGWTF Programming Contest

Last post 09-20-2012 9:20 AM by dhromed. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 04-24-2007 2:57 PM

    The OMGWTF Programming Contest

    Locked Reply Contact

    A couple months back, I mentioned that I’d like to try out something new on this site, specifically, a programming contest. After a lot of thinking and a little bit of coding, I finally put one together: The Olympiad of Misguided Geeks at Worse Than Failure Programming Contest.

    Unlike other programming contests, the goal of the OMGWTF contest is not to flex your algorithmic muscles and solve some abstract computational problem like you might in an ACM contest. Nor is it like the International Obfuscated C Coding Contest; in fact, writing code like that would be a surefire way to lose this contest. Instead, the goal of the OMGWTF contest is to solve an incredibly simple problem using the most obscenely convoluted way imaginable. And for this first contest, the simple problem is to build and implement the logic for a four-function calculator.

     

    Defining “Bad Code”

    One of the bigger challenges in figuring out the contest details was coming up with a way to make purposely “bad code” fun to write and, most importantly, fun to look at. Thinking about the different types of “bad code,” we have:

    • Ugly Code, which is unreadable, unmaintainable, and difficult to understand. We’ve all seen it plenty times (both at work and on this site): single letter variable names, no subroutines, and so on. It’s like building a bench out of rough timber.
    • Buggy Code, which simply riddled with bugs. Null pointers, memory leaks, divide by zeros, etc. It probably works most of the time when used exactly as intended, but any deviation will cause it crashing to a halt. It’s like building a bench using finishing nails and scotch tape.
    • Clever Code, which is unconventional and solves a problem that may or may not be solvable with conventional means. Duff’s Device is a good example of “clever code,” as are many of the samples seen on this site. It’s like building a bench by planting and grafting several small trees together.

    Since the fine folks over at the IOCCC have already compiled some of the most beautiful Ugly Code ever created (seriously – a C-based flight simulator with code shaped like an airplane – that’s impressive), and since looking at Ugly Code is more or less what many of us do each day at work, I’ve decided to exclude Ugly Code as an option altogether. In other words, entries for this contest will need to focus on clean and human-readable code that is, first and foremost, Clever and, if desired, Buggy.

     

    Building The Calculator

    I’ve chosen C/C++ as the language for this first contest. Not only do most of you (85%, last reader survey) seem to know it, but I think C/C++ will give you more than enough rope to hang not only yourself, but the poor end user who runs your calculator. Which, I guess, would be me.

    For the UI challenged, I created a Win32 skeleton solution that you may use. Having not touched C++ in nearly a decade and having only dabbled in Win16 programming once or twice (using an IDE, no less), I figured I’d be the perfect person to put it together. And after several hours of hacking and remembering the doh’s of pointers, I finally got something mostly working. Hopefully.

    The idea is that anyone should be able to download the skeleton solution, fill in the “TODOs” in the code, and simply compile it. The TODOs look like this:

    double DoAdd( double op1, double op2 )
    {
       //TODO: return the sum of op1 and op2
    }

    Of course, you don’t have to use my skeleton solution, but it’s there for you if you’d prefer. For the Linux folks out there, you may use the mostly equivalent GTK skeleton solution.

     

    Judging the Entries

    I asked some of my favorite bloggers to pick out the winning entries, and being the nice guys that they are, they agreed. The OMGWTF contest judges will be Raymond Chen, Joel Spolsky, and Jeremy Zawodny.

    However, before I hand off the submissions to the judges, I will go through and make sure that each one passes the requirements:

    • Meets the Tech Specs (C/C++, Win32/GTK, etc)
    • Meets the UI Specs (allows entering of numbers and displaying of answer)
    • Passes all of Test Cases

     

    An Added Bonus: Static Analysis

    If you haven’t heard of Static Analysis before, it’s definitely something you should check out. It’s a good weapon in the battle for Quality Software that sits somewhere between code review and test cases. A good Static Analysis tool can understand execution paths, user-defined types, APIs, security implications, multi-threading issues, etc. – and make sure that they’re programmed safely.

    As for the Added Bonus, entries will be run through a Static Analysis tool (Coverity’s Prevent to be specific) for an objective look at how Buggy the code is or isn’t. This will present a fun opportunity to shoot for a perfect score (zero defects – how hard could that be?) or the most obscenely Buggy code (extra points for those who exceed a defect/line-of-code ratio greater than 1).

     

    Winning The Contest

    Although you’ll find plenty more details over at the OMGWTF contest site, the author of the winning entry will be awarded a High-Resolution JPEG of an Official Olympiad of Misguided Geeks at Worse Than Failure First Prize Trophy. In addition, if you’d like, I’ll toss in a brand new laptop (choice of a 15” MacBook Pro or Sony VAIO VGN-SZ430N/B) so you can view this JPEG.

    There will also be some runner up prizes, but they won’t be nearly as cool the High-Resolution JPEG (or the new laptop).

    Good luck to all, and make sure to check out the OMGWTF Contest Site for more details. I’ll be back tomorrow with a regular feature article.

  • 04-26-2007 10:04 AM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact
    Any chance we can get a scan of a photo of a printout of the High-Resolution JPEG on a wooden table instead?
  • 04-27-2007 2:22 AM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact

    Contests like this are generally a scam to try get contestants to write products for free instead of hiring employees.

     The price per ksloc is way cheaper with the contest.

     

  • 04-27-2007 6:37 PM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact
    error27:

    Contests like this are generally a scam to try get contestants to write products for free instead of hiring employees.

     The price per ksloc is way cheaper with the contest.

    Yes, because nothing screams "commercial viability" like a bunch of poorly-implemented calc rip-offs.

    You've got a pretty good chance of winning this contest, don't you?
     

    Where can I buy a Codethulu mug?

    What Transpires Forthwith? Obviously, Mangled Genius.

    Any preceding code examples and/or opinions I share are probably specific to Embedded C or ladder logic. That's what I use.
  • 04-30-2007 5:12 PM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact

    Hi! :)   C++ can suck it.  Making them write pretty code is a waste of time. By the way, even if its pretty (properly indented, nice identifiers, etc.), its still just a bunch of text in a file.  Think about that. And the whole concept is that the approach to the problem is supposed to make it more difficult or complicated?? Win32 is a waste of time. Calculators are a waste of time.  You people may think that writing pretty code that does nothing useful in worn-out environments is fun or cool because it is hard...  maybe you think it proves something.  I think it proves that you would all rather waste your time then try to create something useful.  Maybe you think that this proves that you are all so _hardcore_, you just love programming for the fun of it, and the more difficult it is to do something useful, the better.  I guess its a joke.  I don't think its funny.

    Sure, I waste my time with stuff. I play video games. But I don't pretend that makes me an uberleet intellectual supernerd or reward others or try to glorify it and fool people into thinking they are not wasting their time. 

    Here's my programming contest: create a program that does something useful.  Create a program that changes the way we work.  Create a program that reduces the number of times we reinvent the wheel next year to below 150 billion.  Create a program that helps people work together. 

    C++ and deliberately overcomplex calculator programming contests can suck it.

     

  • 05-01-2007 4:00 PM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact
    I'd like to introduce you to something I like to call "fun". Maybe you've heard of it?
  • 05-02-2007 6:01 PM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact

    Yes, code is just text in a file.



    And we're all just a bunch of atoms in an unusual configuration. What's your point? 

  • 05-02-2007 10:16 PM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact
    Veinor:

    And we're all just a bunch of atoms in an unusual configuration.

    Being stuck together into a big ball of rock with watery slush on the surface is a fairly usual configuration for atoms. Or were you looking for specific anomalies below the noise floor?
     

  • 05-07-2007 12:02 AM In reply to

    • phaedrus
    • Top 500 Contributor
    • Joined on 03-19-2007
    • Seattle Ex-Pat living in the Bay Area
    • Posts 111

    Re: The OMGWTF Programming Contest

    Locked Reply Contact
    Veinor:

    Yes, code is just text in a file.



    And we're all just a bunch of atoms in an unusual configuration. What's your point? 

    He's just soar because he really wants a free MacBook and knows he couldn't win the contest if he tried.   

    All men are frauds. The only difference between them is that some admit it. I myself deny it.
    -- H. L. Mencken
  • 05-09-2007 12:02 PM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact

    Wow...

    Hi-res JPG...

    This has got to be THE greatest prize in THE greatest competition ever...

     

     

    Sarcasm... Moi? 

    I wonder what this button does...
  • 07-20-2007 6:21 AM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact

    Is it too late to submit this here...???

  • 11-02-2007 8:47 AM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact
    ithkuil:

    Hi! :)   C++ can suck it.  Making them write pretty code is a waste of time. By the way, even if its pretty (properly indented, nice identifiers, etc.), its still just a bunch of text in a file.  Think about that. And the whole concept is that the approach to the problem is supposed to make it more difficult or complicated?? Win32 is a waste of time. Calculators are a waste of time.  You people may think that writing pretty code that does nothing useful in worn-out environments is fun or cool because it is hard...  maybe you think it proves something.  I think it proves that you would all rather waste your time then try to create something useful.  Maybe you think that this proves that you are all so _hardcore_, you just love programming for the fun of it, and the more difficult it is to do something useful, the better.  I guess its a joke.  I don't think its funny.

    Sure, I waste my time with stuff. I play video games. But I don't pretend that makes me an uberleet intellectual supernerd or reward others or try to glorify it and fool people into thinking they are not wasting their time. 

    Here's my programming contest: create a program that does something useful.  Create a program that changes the way we work.  Create a program that reduces the number of times we reinvent the wheel next year to below 150 billion.  Create a program that helps people work together. 

    C++ and deliberately overcomplex calculator programming contests can suck it.

     

     

    TRWTF is that you reinvent thw wheel 150 billion times a year

  • 09-20-2012 7:22 AM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact

    The real WTF is that there is no such language as C/C++.

    There is a language called C.

    And there is a language called C++.

     

  • 09-20-2012 9:12 AM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact
    Holy mother of Angelfish , what a necro.
  • 09-20-2012 9:20 AM In reply to

    Re: The OMGWTF Programming Contest

    Locked Reply Contact

    Cbuttius:
    The real WTF is that there is no such language as C/C++.
     

    What is wrong with you!


    In complex analysis, a meromorphic function on an open subset D of the complex plane is a function that is holomorphic on all D except a set of isolated points

Page 1 of 1 (15 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems