Tales from the WTF company, part I

Some time ago I had a short episode of working for a Polish branch of a Germany based software company. In this entry (and probably a few following) I’m going to share with you a couple of WTF moments, so if you’re in for a few good laughs, read on! There is also part II of this story.

Monday

The first day started quite normal: I was introduced by the company manager to all 7 programmers, divided in two teams. I was assigned to the smaller, 3 people team. My first task was to build a computer for myself from parts scattered around the company: the box was here, the harddisk there and the monitor had to be taken “temporarily” from one of the servers.

After my computer was up and running, my teammates engaged in a fierce quarrel about which distribution of Linux I should install on my box. As I learned each of them was running a different one and in the second team the situation was looking similar. I chose Ubuntu because the guy sitting next to me (who was assigned as my “mentor”) was using it and he had the install CD ready.

Then the other guys started to remind him that he had several problems with this distribution (some related to work and some completely unrelated but that seemed irrelevant to them) and he fought back arguing that they had also trouble with their distros and it was at least as bad as his own if not worse. From this argument I understood that they had continuous problems with running their app on their systems (as in “it works on my box, why doesn’t it work on yours?”) and spent quite a lot of time trying to fix them. It also seemed that each of them used their own set of incompatible tools and scripts which they developed or configured individually.

Don’t get me wrong: I’m not trying to prove that they were completely stupid. It was just the opposite: they were smart, friendly, helpful and fun to talk with. We spend a lot of time talking about their hobbies, cars, games, movies, music and books. But at the same time I started to get a feeling that they were completely amateurish in their work.

To the end of first day I managed to get Ubuntu running, installed Eclipse and some other tools and checked out the project from the SVN. In the meantime, my mentor gave me a talk about the architecture of their system which seemed awfully complicated to me but I decided to keep my comments to myself at least until I get to see and understand the code. The system was written in Python and its main purpose was to process requests from the web app and issue queries to many different vendors, gather the results and send them back to the web app. He also told me that they had a big problem with the system being much too heavy and slow.

Tuesday

Next day I started browsing the source and felt my heart sinking like, well, something that is sinking really fast. So fast it’s going to fall into pieces when it smacks into the bottom of the sea. I hoped that their system would be elegant and beautiful just because of being written in Python. Instead it looked like if someone was trying create Python’s equivalent of worst PHP anti-patterns. Most of the classes were several thousand lines long and contained code dealing with everything for one vendor. Each of those behemoths sported methods of at least 200 lines long but 500 wasn’t rare at all.

After taking a closer look I noticed that most of the code was carefully copied/pasted from one place to another. Each of those methods processed one kind of request from start to end: initialized database connection with hardcoded username and password, constructed and issued the query, processed and formatted the results, caught exceptions and so on. I regret not running any metrics on this steaming pile of excrements but my guess was that after the duplicated code would be properly refactored into separate methods, it would be 3 to 4 times smaller. Do I have to add that the system wasn’t stained with a single line of test code?

I started asking the guys about those problems and their answers shocked me even more. The conversation ran something like this:

Me: Why don’t you guys use separate functions to avoid all this code duplication?

Them: Don’t you know that functions induce time overhead? Calling them and returning just takes too much time.

Me: AFAIK this overhead is negligible in most cases. Have you run some profiler to see if calling functions is really a bottleneck here?

Them: Of course we have. But you see this Python profiler is really stupid. It didn’t tell us anything useful.

I had a hard time believing this but not being an expert in Python profiling myself I decided to leave this path for now and concentrate on other aspects:

Me: But don’t you think that this copied/pasted code looks like a mess?

Them: Not at all. You have all the code right before your eyes. You don’t have to go looking for a function definition to see what it does.

Me: What if the duplicated code contained some bug? Don’t you think fixing it would be a problem?

Them: How can this be a problem when Eclipse has search&replace function?

That’s it for part one, but stay tuned! There is part II of this story.

About these ads

17 responses to “Tales from the WTF company, part I

  • szeryf

    Yes, it’s 99% true. It was a few years ago so I had to patch or skip a few unimportant details I couldn’t recall correctly, but otherwise is as true as it gets.

  • Cyndy Aleo-Carreira

    OMG… crying laughing. Can’t wait to read the second part.

  • Anon

    Fail, gray text on black background way too hard to read!

  • Tom

    Was this team responsible for the code originally or was it inherited from somewhere?

    It seems unusual for a small team to take so pride in their work.

  • freesid

    LOL

    Right now i am working on a research prototype, in a big company, and its code is even messier. Let me give you two examples:

    1. 700 lines of C functions inside kernel and in Xen hypervisor ?

    2. 45 Kilobytes of data is copied from one buffer to another with interrupts disabled. wtf ?

    And whats worst is, these guys who wrote the code has 6-10 years of experience. One guy is manager ;-).

    They don’t use normal spinlocks, they always use irqsave/irqrestore spinlocks everywhere. Yeah, all those ‘Avoid spinlocks’ warnings are not for us ;-)

    Aah, im gonna quit soon.

  • Andy

    This kind of stuff isn’t even remotely rare. If anyone is really laughing that hard at this they haven’t been exposed to the normal workforce yet.

    I had a guy at work that stopped using semi-colons in all his Actionscript 2 code because he claimed they increased file size. AS may have been built to not use them some 6 years ago, but the compiler really can’t handle it that well and often would fail to compile his code. And, of course, he saved absolutely nothing on filesize, because the compiler doesn’t keep the ;s…

  • Thomas Lann

    I’ve dealt with this sort of thing at least 3 times and I’ve only been out of college 4 years. When I say this sort of thing I mean encountering code for people that don’t understand what the f*3k they are doing.

    No I don’t mean someone that knows Java and is learning Python. I’m talking about a person who just started programming or one that was a database person and knew ‘SQL’ but had never programmed.

    In my first experience, the person before me, took 2 years and was paid 200k to start with an old program and upgrade it. I took it over from him. It was in a language and development enviroment called Rapid. I had never dealt with or heard of it.

    After learning the language and the code base I found he had put a bug into it to go into an endless loop after after a certain date. I also added all of the requirements they wanted and cut the code size by 1/2 in 6 months. I ended up rewritting about 80% of the code because it was really bad. The guy had written 32 different functions to do the same thing except for 3 variables that had changed.

    The current company I’m working with on a part time basis on the weekend for about 20 hours. I was actually looking for another full time job when I came across this company. After interviewing with them and seeing there code base I knew I didn’t want to work for them full time so I offered to work for them on the weekends 20hours a week and they let me.

    There programmer was just learning C++ and did databases before. The code was a mess. I found things like indexes in arrays that were out of bounds. 2500 lines functions and lots of globals in each class.

    At first, I was upset with this person. But now I realize they have given me a great opportunity to make a lot of extra money and gain experience.

    I think all of these bad programs can be a good opportunity to make extra money and then move on. You can also keep the people in the company as a good point of contact and reference.

  • dow.ngra.de » Blog Archive » WTF Company

    [...] to extend. He said no, because their parsing works just fine, thank you. — Somehow this (part I, part II) is even scarier that reading it on DailyWTF. Does anyone recognize your own company? I [...]

  • mikeyhell

    I worked for a company that had a similar approach to programming. I found after many months of struggling to understand wtf was going on, that they preferred to program this way b/c it meant more billable hours to the clients. In reality some of their projects should have taken 1-2 months, but were bloated to 6+ month long ordeals, with endless problems after the projects had been ‘completed’.

  • vilaca

    lololol

    tell me this a fictional tale… please…… :D

  • Cory

    I think I’ve introduced more bugs when I tried Search & Replace than I ended up fixing.

    I take it Wednesday was your last day? ;-)

  • Steve

    “To the end of first day I managed to get Ubuntu running, installed Eclipse and some other tools and checked out the project from the SVN” -> Dude, from this sentence on, you already have it WAY better than me. Try working in a Windows network with SourceSafe sometime and see how you like it.

  • Justin

    Please turn off the snapshots popups. I don’t need bubbles popping up all of the place when I’m trying to read your article.

  • szeryf

    Tom: I’m not sure about the very beginning but I’m pretty certain that almost everything was “designed” and written by themselves.

  • kretes

    Hello, Great story! :-) – were You scared or were You laughing at that time? :D

    If You don’t want to tell the company name – tell what city was that and do You know if that company is still operating? :D

  • szeryf

    kretes: both :) yes, it’s still operating and still looking for new hires :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: