tags:

views:

879

answers:

14

Anybody seen a Rube Goldberg software design? Basically, complicated design for simple stuffs.

Please share your stories.

A: 

Imagine a configuration file that looks like this:

  <param name="foo">
      <name>p1</name>
      <name>p2</name>
      <param name="bar">
            <name>q1</name>
           <name>q2</name>
           <name>q3</name>
           <param name="foobar">
                 <name>q1</name>
                 <name>q2</name>
                 <name>q3</name>
                 <parame name="barfoo">
              ....
                  </param>
           </param>
       </param>
     </param>

and a parser that looks like this

int i = 0;
while (n.hasChild("param"))
{ 
   if (n.name()=="param")
   {
     process new node n
     i++
     else{
        //add child
     }
}

In case you're wondering, the "i" is used later to figure out how many params you have. And this is an extremely cleaned view of the code.

Steve B.
+2  A: 

I have not seen any in production, but I did get a kick out of seeing Hello World with design patterns at the following site:

http://www.phppatterns.com/docs/design/hello_world_in_patterns

Rontologist
+3  A: 

The Daily WTF you source for more Rube Goldberg software that you could possibly care to read about :P.

Aaron Maenpaa
A: 

Might be better to look for answers to this question over at The Daily WTF :)

AR
A: 

It seems like every data conversion I've done from a Filemaker Pro database makes me think that the database was designed by Rube himself.

Let's see... All fields are 256 chars long. Company names used as primary keys (wait! don't change the name...) De-normalized database structure (payment1date, payment2date ... payment256date).

(Not that I'm dissing Filemaker Pro. It's just that it enables non-programmers to design databases that eventually need to be converted into some other application.)

Kluge
+5  A: 

This is something I heard from a co-worker. Apparently, he found a web application which does something like this for client side javascript text box validation:

  1. Javascript constructs a string to represent the client side textbox.
  2. sends the string to the web server.
  3. web server uses reflection to reconstruct the text box on the server from the passed string.
  4. web server checks if the text box has a value.
  5. returns the result to the client.
  6. client displays the message.
  7. during the time the web server does its validation, client displays a progress bar.

the progress bar implementation is good for another post. :)

Gulzar
+1  A: 

When I was at a well-known anti-virus and remote access software company a co-worker who for some reason was thought of by some low level managers as really excellent used to write all sorts of complicated stuff. I dreaded working on his code. Much of it was all unnecessary. I finally had to chat with him when I found that he had introduced MFC to a previously mfc-free library (we were trying to keep that crap out of some of our code). He apparently needed it for strings and collections. I showed him stl. He was very enthusiastic about it and seemed to really take my suggestions to heart. Later on when i looked at the code again I saw that he had implemented the MFC collections and wrapped STL with his own interfaces so that they looked like mfc collections. Wow. just wow.

Another totally useless developer at the same company apparently didn't like to use inheritance in C++ - in spite of him copying pages from "Effective C++" to give as tests to potential hires. Anyway, during a code review one of the people who reported to me asked why Pete was using #ifdefs in his code all over the place. His project would compile 4 times and each time it would define a different key word. The conditional code was for specific behavior and all the other code was for similar functionality. I was blown away. And this guy was also thought to be a golden boy. He singlehandedly caused a re-release of a product because he left a debugging messagebox in a win32 service process - effectively hanging the service because he refused to learn how to use the source-level debugger - but that is another story.

Tim
A: 

99 Bottles of Beer also has lots of examples. For instance the Advanced, extensible beer/wall framework. Which, amusingly, is written in python and not Java.

Aaron Maenpaa
+3  A: 

Since Duff's Device has been popular here today, I think it's appropriate as complicated code doing something simple:

dsend(to, from, count)
char *to, *from;
int count;
{
    int n = (count + 7) / 8;
    switch (count % 8) {
    case 0: do { *to = *from++;
    case 7:      *to = *from++;
    case 6:      *to = *from++;
    case 5:      *to = *from++;
    case 4:      *to = *from++;
    case 3:      *to = *from++;
    case 2:      *to = *from++;
    case 1:      *to = *from++;
               } while (--n > 0);
    }
}

Note that it is actually super efficient, compared to:

do {                          /* count > 0 assumed */
    *to = *from++;            /* Note that the ''to'' pointer is NOT incremented */
} while (--count > 0);

However, the sheer elegance of depending on C's switch fallthrough makes it Rube worthy.

FlySwat
Duff's Device is also mostly obsolete these days. Compilers will often unroll such loops for you.
Zan Lynx
A: 

Not super long, but still ridiculous. To clear out a StringBuilder:

If sb.Length > 0 Then
  sb.Remove(0, sb.Length)
End If
swilliams
+3  A: 

One of our junior programmers once wrote what was supposed to be a simple AJAX-ified auto-suggest text box for searching user accounts in one of our applications.

This was his process:

  1. Run SELECT * FROM Users against the database
  2. Return the full results in a GetAllUsers() web service method
  3. Loop through the XML results in Javascript to find names matching the characters typed so far and add them to an array
  4. Loop through the array to create the auto-suggest drop-down list
  5. Repeat entire process for the next letter typed...

This actually worked pretty well when he tested it with 10 sample users, but brought the system to a screeching halt when run against a full test set of 3000 users.

Raelshark
A: 

I once inherited an application that handled configuration files in a rubegoldbergian fashion. The configuration was a simple plain-text XML file, with the keys and values fully human-readable. On startup, the application would open the XML file, iterate through all the key/value pairs, encrypt both the key and value of each, create a hash of the encrypted key, and add the encrypted key/value pair to a static hashtable.

The function for reading a setting took an ordinary string key and returned an ordinary string value, so it had to encrypt the key, hash it and use the hash to locate the key/value pair in the hash table, and then decrypt and return the value.

We called this in-memory encryption. I still have no idea what sort of thought processes led to its creation, but I thought of Mousetrap the moment I saw it.

MusiGenesis
A: 

Found this on stackoverflow, Enterprise FizzBuzz. The best example I've seen of taking a simple problem and putting way too much "enterprise" code around it.

James McMahon