ARGH! What's your favorite coding horror story?

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

myrcutio
Posts: 44
Joined: Wed Dec 30, 2009 7:28 pm UTC

ARGH! What's your favorite coding horror story?

Postby myrcutio » Mon Feb 25, 2013 8:57 pm UTC

I work a great deal with a templating language called freemarker. It's a decent language, has lots of support for macros, lists, and can do some cool things with nesting. A little while ago, one of my back end developers decided that he could make it "better", and so he started to write his own language. I won't name the language in case he reads these forums, but for the sake of argument lets call it DIAF. He replaced all the reusable macros with fixed state pages, and replaced if/else with an incredibly convoluted set of behaviors and show/hide states. Suffice it to say the thing is a hot steamy mess on the carpet.

So one day I need to override one of his templates. Nothing big, just adding an extra label. Easy right? Well after hours of digging through inheritance trees and tinkering with linked modules, i notice a funny little line. something like

Code: Select all

<data:headerNavSection>


Kind of an odd syntax I thought, it didn't show up in any of the other DIAF files, and it wasn't a node in the shared object model. Turns out, it was a call back to the existing freemarker templates. He wrote an entire clumsy, featureless, rigid language that in the end just uses freemarker macros anyway. It was the most gloriously pointless and ridiculous waste of time I've ever witnessed.
"Lightning must have hit it, and now it won't work in anything but Windows 95."

Faustus runs afoul of Microsoft.

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: ARGH! What's your favorite coding horror story?

Postby Steax » Tue Feb 26, 2013 11:58 am UTC

I ran across something like this on code I was asked to take a look at:

Code: Select all

<button data-pre-action="$formID = 'comment'; $conn = mysql_connect('localhost', 'root', 'root'); $db = mysql_select_db('db'); select_template('comment_form');">Submit</button>


Yes, the PHP code was inlined to be eval'd. They said it was to avoid having too many template pages, and "we're sure none of our employees would like to hack our server."
In Minecraft, I use the username Rirez.

User avatar
zmic
Posts: 427
Joined: Fri Mar 02, 2012 10:38 pm UTC

Re: ARGH! What's your favorite coding horror story?

Postby zmic » Tue Feb 26, 2013 6:29 pm UTC

A long time ago I worked for a software company that was very sophisticated, because they had a version control system (cvs). So how did this work? Well, every once in a while somebody made a zipfile of the the source tree and then committed this zipfile to the version control system. :D

User avatar
Negrebskoh
Posts: 139
Joined: Fri Mar 01, 2013 11:49 pm UTC
Location: The Netherlands

Re: ARGH! What's your favorite coding horror story?

Postby Negrebskoh » Wed Mar 06, 2013 11:26 am UTC

I think most of the horror stories I remember have something to do with the computer crashing when I've not yet saved a half-day's worth of code.

And it ONLY happens when you've not saved your code in a while.

User avatar
c_programmer
Posts: 93
Joined: Sun Apr 04, 2010 1:36 am UTC

Re: ARGH! What's your favorite coding horror story?

Postby c_programmer » Wed Mar 06, 2013 8:59 pm UTC

Where to begin...

During an internship I had I was tasked with understanding and fixing an enormous (>100,000 lines) ASP classic system. It spanned eight websites and had over 2,000 SQL injection vulnerabilities. The way it distinguished user rank was with a cookie called "adminflags" that needed to be set to 1. We got hit with an XSS attack that introduced a virus to our networks in the midst of this. The only saving factor is that the server didn't save any personal info outside of plain text passwords. This was a mortgage company worth over $1b and is traded on Nasdaq.

At the same company our CTO came in and began to brag about his front page skills (in complete seriousness).

At the same company we found a (most likely joke) prostitute ordering website called "risque business" on one of our servers.

A consulting job I one did was with a smaller company who had every password as a single lowercase English word. I found a love note from a hacker in their webroot, luckily he didn't do any damage.

Any time a potential client talks about a custom CMS an offshore company had made for them I know a good story is soon to follow. One of them had comments every few lines, most of them saying stuff like "comment." This was likely due to a rigid contract requirement for them to comment their code. Another stored all the files in a directory above the webroot and dynamically called includes to those files without any real checks.

xGeovanni
Posts: 36
Joined: Thu Oct 06, 2011 7:03 pm UTC

Re: ARGH! What's your favorite coding horror story?

Postby xGeovanni » Sun Apr 14, 2013 3:36 pm UTC

During my first attempt at OOP, I wrote this gargantuan piece of shit.

I recommend you read the whole thing to get a true grasp of how horrible, broken and buggy it really is, but I will tell you that it contains such redundancies as:

Code: Select all

def name(name):
        #The player's name
        return name


And such woeful pieces as this (brace yourself):

Code: Select all

def char_build():
    #Creating a character / player
    PLR = player()
 
    plrname = input("Name your character: ")
    PLR.name = player.name(plrname)
 
    race_chosen = False
    races = ("human", "orc", "elf")
   
    while not race_chosen:
        print("\nRaces: Human, Orc, Elf")
        race = input("Choose your race: ").lower()
 
        if race in races:
            PLR.race = player.race(race)
            race_chosen = True
 
        else:
            print("That race is not available")
   
    print("\nClasses: Warrior, Mage, Priest, Bard, Ninja, Guard")
 
    class_chosen = False
    while not class_chosen:
        classchoice = input("Choose your class: ")
        classchoice = classchoice.lower()
   
        if classchoice == "warrior":
            PLR.playerclass, PLR.baseHP, PLR.baseMP, PLR.baseATK, PLR.baseDEF, PLR.baseWIS, PLR.baseSPD = PLR.playerclass(warrior = True)
            class_chosen = True
        elif classchoice == "mage":
            PLR.playerclass, PLR.baseHP, PLR.baseMP, PLR.baseATK, PLR.baseDEF, PLR.baseWIS, PLR.baseSPD = PLR.playerclass(mage = True)
            class_chosen = True
        elif classchoice == "priest":
            PLR.playerclass, PLR.baseHP, PLR.baseMP, PLR.baseATK, PLR.baseDEF, PLR.baseWIS, PLR.baseSPD = PLR.playerclass(priest = True)
            class_chosen = True
        elif classchoice == "bard":
            PLR.playerclass, PLR.baseHP, PLR.baseMP, PLR.baseATK, PLR.baseDEF, PLR.baseWIS, PLR.baseSPD = PLR.playerclass(bard = True)
            class_chosen = True
        elif classchoice == "ninja":
            PLR.playerclass, PLR.baseHP, PLR.baseMP, PLR.baseATK, PLR.baseDEF, PLR.baseWIS, PLR.baseSPD = PLR.playerclass(ninja = True)
            class_chosen = True
        elif classchoice == "guard":
            PLR.playerclass, PLR.baseHP, PLR.baseMP, PLR.baseATK, PLR.baseDEF, PLR.baseWIS, PLR.baseSPD = PLR.playerclass(guard = True)
            class_chosen = True
        else:
            print("That class is not available")
 
    PLR.plrlevel, PLR.exp2level, PLR.exp, PLR.oldlevel = PLR.level(plrlevel = 1, exp = 0)
 
    PLR.HP, PLR.MP, PLR.attack, PLR.defence, PLR.wisdom, PLR.speed = PLR.stats(PLR.plrlevel, PLR.race, PLR.baseHP, PLR.baseMP, PLR.baseATK, PLR.baseDEF, PLR.baseWIS, PLR.baseSPD)
 
    PLR.moves = player.moves(PLR.playerclass, PLR.plrlevel)
 
    PLR.stats = PLR.HP, PLR.MP, PLR.attack, PLR.defence, PLR.wisdom, PLR.speed
 
    print("\nYour moves are:")
    PLR.showmoves()
 
    return PLR

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: ARGH! What's your favorite coding horror story?

Postby You, sir, name? » Mon Apr 15, 2013 8:17 am UTC

Some people do not understand the finer point of version control.

Why check in a source tree when you can check in a zip of the source tree. Much less clutter in CVS!

Release tag? What's that? We use backup directories, and if that fails, there's tape backups somewhere that work sometimes (generally only in part).
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Negrebskoh
Posts: 139
Joined: Fri Mar 01, 2013 11:49 pm UTC
Location: The Netherlands

Re: ARGH! What's your favorite coding horror story?

Postby Negrebskoh » Mon Apr 15, 2013 11:22 am UTC

You, sir, name? wrote:there's tape backups somewhere that work sometimes (generally only in part).

You work at the National Museum of Computing? :P

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: ARGH! What's your favorite coding horror story?

Postby EvanED » Mon Apr 15, 2013 3:29 pm UTC

Negrebskoh wrote:
You, sir, name? wrote:there's tape backups somewhere that work sometimes (generally only in part).

You work at the National Museum of Computing? :P
Hey, don't knock tape; tape still sees plenty of use. Tape can be cheaper on a per-GB basis than even consumer hard drives, and actually made for backup (as opposed to hard drives which often suffer if you just leave them sitting around without being spun up).

User avatar
Negrebskoh
Posts: 139
Joined: Fri Mar 01, 2013 11:49 pm UTC
Location: The Netherlands

Re: ARGH! What's your favorite coding horror story?

Postby Negrebskoh » Mon Apr 15, 2013 5:28 pm UTC

EvanED wrote:
Negrebskoh wrote:
You, sir, name? wrote:there's tape backups somewhere that work sometimes (generally only in part).

You work at the National Museum of Computing? :P
Hey, don't knock tape; tape still sees plenty of use. Tape can be cheaper on a per-GB basis than even consumer hard drives, and actually made for backup (as opposed to hard drives which often suffer if you just leave them sitting around without being spun up).

But... it's tape!

*hides in his born-in-the-90s field of distortion*

User avatar
Xenomortis
Not actually a special flower.
Posts: 1445
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: ARGH! What's your favorite coding horror story?

Postby Xenomortis » Mon Apr 15, 2013 5:37 pm UTC

Image

User avatar
freakish777
Posts: 354
Joined: Wed Jul 13, 2011 2:14 pm UTC

Re: ARGH! What's your favorite coding horror story?

Postby freakish777 » Tue Apr 16, 2013 8:24 pm UTC

Not exactly horror. More like the Bruce Campbell version of horror.

So, I'm working at a start-up as my first job out of college. One of my co-workers is tasked with making a particular page faster, because it's slow. So he finds out what's happening on the page, we're calling some Stored Proc inside a loop (pretty standard stuff, well not really it was called 5 different times inside this loop for some reason). So he takes it out of the loop (and makes it 1 call instead of 5), and references the DataSet instead. He get's told "The Page is still too slow, the execution time on that proc is still too high, you gotta optimize that Store Proc man!" So he looks at this big ugly proc that was written by someone long since gone from the company, and changes up the JOINs to try and make it run faster, and makes sure all the tables/views referenced have proper indexes. He's told "Good job, but it's still too slow." So he looks at the code. Turns out, the data returned from this Stored Proc? The page wasn't using it at all.


Other weird stuff:

Having your page return what looks like a 403 Page Not Found Error but Fiddler says it's a 200 response but with:

fiddler.network.https> Failed to secure existing connection for eservices.tn2.paychex.com. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. InnerException: System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

and there being nothing in Event Viewer for either the Application Log or in IIS that would indicate any forcibly closed connections.

The cause turned out to be an extra Default page somehow getting specified in the applicationHost.config somehow. Our SysAdmin tells us he has no idea how it got there.

User avatar
ekolis
Posts: 76
Joined: Sat Nov 19, 2011 11:44 pm UTC
Location: Cincinnati, OH, USA
Contact:

Re: ARGH! What's your favorite coding horror story?

Postby ekolis » Wed Apr 17, 2013 6:03 am UTC

I was once involved with project that had a legacy codebase/database. Said database contained this amazingly awesome table name: "tbCompetencyGroupModelCompetencyModel". You see, there were already two other tables, tbCompetencyGroupModel and tbCompetencyModel, and "The Big Honking Table" (as we liked to call it) was a mapping table between the two. Why the "model" suffix on the table names? Either the previous developers had a fetish for some actress or other, or (more likely) they had heard of MVC and wanted to apply it. Not that there was any sort of MVC architecture anywhere in the system. :roll: (But who could blame them - it was WebForms...)

Also, I was once codezz0ring like a zombie late at night when I decided to make a variable called "datas2". Yeah, "datas2". You see, I had an ItemData class (yay for stupid class names), and I wanted to store a collection of them. But not just one collection of them - I needed to store TWO collections of ItemData objects!
Reading posts on the xkcd forum makes me feel stupid.

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 6568
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: ARGH! What's your favorite coding horror story?

Postby Thesh » Wed Apr 17, 2013 6:35 am UTC

Xenomortis wrote:Still going strong.
http://www.computerworld.com/s/article/ ... city_ships


I find it so weird that they advertise the capacity for compressed data.
Summum ius, summa iniuria.

Carnildo
Posts: 2023
Joined: Fri Jul 18, 2008 8:43 am UTC

Re: ARGH! What's your favorite coding horror story?

Postby Carnildo » Wed Apr 17, 2013 8:17 am UTC

You, sir, name? wrote:Some people do not understand the finer point of version control.

Why check in a source tree when you can check in a zip of the source tree. Much less clutter in CVS!

Release tag? What's that? We use backup directories, and if that fails, there's tape backups somewhere that work sometimes (generally only in part).

I'm still trying to get my co-workers into the habit of using version control. When I got there, sharing was accomplished by keeping a copy of the source tree on a server that people would pull from periodically, while pushes were done by sending the modified source files to the lead developer to incorporate into his master copy of the source tree, and versioning consisted of making a zipped copy of the source tree every time a new version was released. This was a perfectly good method back when the company started (only two developers, and SCCS was the state of the art in revision control software), but things have changed since then.

Negrebskoh wrote:
EvanED wrote:
Negrebskoh wrote:
You, sir, name? wrote:there's tape backups somewhere that work sometimes (generally only in part).

You work at the National Museum of Computing? :P
Hey, don't knock tape; tape still sees plenty of use. Tape can be cheaper on a per-GB basis than even consumer hard drives, and actually made for backup (as opposed to hard drives which often suffer if you just leave them sitting around without being spun up).

But... it's tape!

*hides in his born-in-the-90s field of distortion*

For data volumes between "large" (currently about 20 TB) and "too big to back up" (think: Google), tape is the cheapest available storage option; it's also the most reliable for long-term archiving (hard drive bearings tend to seize up after a few years of sitting).

User avatar
Negrebskoh
Posts: 139
Joined: Fri Mar 01, 2013 11:49 pm UTC
Location: The Netherlands

Re: ARGH! What's your favorite coding horror story?

Postby Negrebskoh » Wed Apr 17, 2013 8:57 am UTC

Carnildo wrote:hard drive bearings tend to seize up after a few years of sitting

Why is that, actually?

wumpus
Posts: 546
Joined: Thu Feb 21, 2008 12:16 am UTC

Re: ARGH! What's your favorite coding horror story?

Postby wumpus » Wed Apr 17, 2013 3:04 pm UTC

xGeovanni wrote:During my first attempt at OOP, I wrote this gargantuan piece of shit.


I learned OOP the other way, writing OOP-friendly code (asynchronus networking) in an OOP-friendly language (python) in FORTRAN. As in "real programmers can write FORTRAN in any language" (and store everything in lists forced to emulate arrays). Spent at least a month trying to debug it. Stopped, questioned my assumptions, figured out what this new-fangled OOP was, and rewrote the whole module. Total time spent (from figuring out basic examples of OOP in python to debugging the code to reasonably work): two days.

Carnildo
Posts: 2023
Joined: Fri Jul 18, 2008 8:43 am UTC

Re: ARGH! What's your favorite coding horror story?

Postby Carnildo » Thu Apr 18, 2013 5:24 am UTC

Negrebskoh wrote:
Carnildo wrote:hard drive bearings tend to seize up after a few years of sitting

Why is that, actually?

The bearing lubricants break down over time.

pbfy0
Posts: 1
Joined: Sat Apr 20, 2013 6:36 pm UTC

Re: ARGH! What's your favorite coding horror story?

Postby pbfy0 » Sat Apr 20, 2013 7:04 pm UTC

xGeovanni wrote:During my first attempt at OOP, I wrote this gargantuan piece of shit.

I recommend you read the whole thing to get a true grasp of how horrible, broken and buggy it really is, but I will tell you that it contains such redundancies as:

*spam-filter-avoiding snip*

I rewrote it, using 5 classes, a total of 10kb, and in general, better code. Because I have under 5 posts, I can't link directly, github DOT com SLASH pbfy0 SLASH RPG


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 5 guests