Live data from Hacker News

The worst program I ever worked on

jacquesmattheij.com

71–80 of 136 posts

Re: The worst program I ever worked on

#71

Back in the day, I was an RPG programmer (on an AS/400), and I had a co-worker who insisted upon using geographical labels for all of his GOTO targets: GOTO BARCELONA, GOTO TOKYO, etc. Needless to say, maintaining his code took some getting used to.

The thing about languages that require GOTOs is that there is often no inherent meaning in the label, such as in a control structure that we'd take for granted these days, and back in the day you were often limited by token size (in one assembler I used it was 5 characters) so people sometimes used schemes like "A0001", "A0002", etc. or sometimes "DOG", "PIG", "CAT", etc. though the former was preferable as it wasn't distracting.

Re: The worst program I ever worked on

#72
post #56

One of my former classmates names everything he can get his hands on after various obscure anime references-- database names, variables, servers, you name it. Once in a blue moon, I'd recognize a function name as being a character or item from one of the few animes I'd seen and after a bit of tortured logic based on the background it almost seemed like a reasonable choice. Needless to say, he does better working on h…

I wonder if he read the Manga guide to databases: http://www.amazon.com/Manga-Guide-Databases-Mana-Takahashi/d...

My god... I guess it shouldn't surprise me that an EduManga industry exists.

Re: The worst program I ever worked on

#73

The legacy system that I'm working on now has about 20-30 distinct classes/data types that it needs to manage and persist to the database. The previous developer chose to implement all of these different data structures in one uber-table named 'object' and in the application code with one uber-class named 'Thing'. Relationships between 'Things', regardless of meaning or type, are simply dumped into a 'relationship' t…

One of my favorite accessor method names I've run across is 'maybeGetCube()'. The idea was that if it was cached, then it would return the cube, otherwise null. Cube was actually relatively aptly named, it was a big matrix of data BTW. I guess really it wasn't THAT horrible, but the whole idea of 'maybe' doing something in code has always made me chuckle.

I guess you've never tried Haskell then. :)

http://hackage.haskell.org/packages/archive/base/4.1.0.0/doc...

Re: The worst program I ever worked on

#74
post #41

I met the guy who wrote this bit that I had to maintain: for(a=0;a What really pissed me off was that he was such a nice guy. He still works a lot. Makes a lot of money. And his customers love him. (No, I don't think they review his code.)

Did you ever ask this person why he wrote this code in this manner? Did he trot out the "job security" crap or was there a legit reason?

Re: The worst program I ever worked on

#75
I once worked on a game for the Wii using a 7 year old engine originally developed for the PS2. The company had a high turnover rate and the code was atrocious. The engine had been used for several games and each title introduced a new hack in the engine. You had the tipical spaghetti with meatballs mess with 2000+ lines functions and hacked code with comments like: "This code is for the E3 demo of the game xxx". Once I had to extend a 1000+ line switch statement.

But the worst I saw was something like this:

struct weapon { #ifdef xxx #include xxx #else ... #endif }

Re: The worst program I ever worked on

#76
post #41

I met the guy who wrote this bit that I had to maintain: for(a=0;a What really pissed me off was that he was such a nice guy. He still works a lot. Makes a lot of money. And his customers love him. (No, I don't think they review his code.)

Unless there is a lot of creative abuse of operator overloading or macros lurking in there that code really doesn't look too awful compared to some monstrosities I've had to work with.

I agree. At first glance, I thought that the NbrofA/AA/etc names were just gibberish. The most nonsensical part to me is starting the for-loop iterator at zero, and then only executing the function if the iterator is non-zero.

Re: The worst program I ever worked on

#77
post #34
post #11

I worked with a guy (I won't name the company) who wrote Java code in one, huge, static class as much as possible. In fact, everything was largely in one function too. He decided to name his fields alphabetically. static int a static int b static String c static float d static int e... What, I wondered, would happen when he ran out of letters? Scrolling down further I saw this: static int aa static float ab static St…

I work with a guy, long time ago, who would take code already split into functions and refactor it into one big function. I am not joking here, actually happened.

Happened to me in a college course - fortunately I haven't seen it since. However the CURRENT codebase I'm working on is a whole other set of nightmares.

Bonus points for the fact that they don't let me fix it...

Re: The worst program I ever worked on

#79

The legacy system that I'm working on now has about 20-30 distinct classes/data types that it needs to manage and persist to the database. The previous developer chose to implement all of these different data structures in one uber-table named 'object' and in the application code with one uber-class named 'Thing'. Relationships between 'Things', regardless of meaning or type, are simply dumped into a 'relationship' t…

One of my favorite accessor method names I've run across is 'maybeGetCube()'. The idea was that if it was cached, then it would return the cube, otherwise null. Cube was actually relatively aptly named, it was a big matrix of data BTW. I guess really it wasn't THAT horrible, but the whole idea of 'maybe' doing something in code has always made me chuckle.

There are a few methods in the .Net library for converting types called TryParse(). It's actually pretty handy, because it's an easy way get some string data munged into the type you currently want. Not that I would use this on a method that returns a matrix...

Re: The worst program I ever worked on

#80
post #40

Earlier quoted context omitted.

To really bork up the Java, you need a pattern fanatic. Once you stand working with Handler Adapter Handlers you know you should have taken the other colour pill.

Yes, i remember working for a company (java devs) where at some point we ended up having wrappers around wrappers around wrappers delegating stuff around, factories of factories ... It made your head spin.

I mean this dead seriously: People complain about the abstractions like "Monad" in Haskell, but I'm yet to see anything as abstract and difficult to reason about as a decorator around a facade delegating to an implementation of a factory factory of something probably producing a concrete instance of some other pattern monstrosity.
Post reply on HN