Live data from Hacker News

The worst program I ever worked on

jacquesmattheij.com

21–30 of 136 posts

Re: The worst program I ever worked on

#21
The only place where the names made any immediate sense was 'main' and any C stdlib calls.

Any job worth doing is worth doing right. Contrariwise, any job worth fucking up is worth fucking up stupendously. He didn't go all the way.

  #define monkeymeat printf
  #define turtlescrotum malloc
  #define wolfnipplechips gets
  #define chipotlaway exit
  ...

Re: The worst program I ever worked on

#22
post #20

This is off topic but I find it difficult to read the blog-articles from jaquesmattheij.com . Zooming doesn't help because the text doesn't wrap correctly. Just a suggestion for the author to change the layout of the page.

You should try readability.com

Re: The worst program I ever worked on

#23
I worked on a piece of code that literally drove the guy who wrote it round the bend. He had a mental breakdown, ran away, and eventually ended up in a different state ~3000 miles away.

It wasn't so bad.

Now debugging code written by Chemistry Students... that's some scary stuff right there.

Which is not to go all elitist and put Comp Sci degrees up on a pedestal, one of the better coders I've had the pleasure of working with was a trained vet. He was very methodical.

Actually, now that I think about it, working with something that if you make it angry it will bite your hand off, is probably good preparation for dealing with a compiler...

Re: The worst program I ever worked on

#24
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…

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.

Re: The worst program I ever worked on

#25
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…

There was one networks class I took where the assignment was to implement a simple network protocol to do file transfers over a serial port. Computers in the lab were paired up and had their serial ports connected to one another. People were assigned to computers and given either the receiver or transmitter to implement.

I was about done implementing the first draft of my side and asked the other side how it was going so we could test some actual communication. The response I got was "it's about done, we just need to split it up into functions". I was initially shocked and then naively impressed that someone could actually reason about the problem without breaking it down.

The end result was of course that I just had to give up and implement both sides of the communication. This was eventually a much better learning experience. I ended up abstracting out the serial port and allowing the two sides to communicate through a unix pipe with random bit errors introduced in packets to test the recovery. I could then run much longer testing without depending on the lab or someone else. I think I eventually tested it enough that I was up against the fundamental problem that the cheap checksum we were using let errors pass way too easily.

Re: The worst program I ever worked on

#26

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.

That sounds kind of funny. Where do you go on error? One time I had to debug this incredibly obfuscated Word Basic subroutine. It was such a mess of gotos (deliberately so) that the company that wrote it for us thought they had us over a barrel and could charge us like a wounded bull. That is, until I showed my cow-orkers the superior technology of "paper, scissors and sticky tape".

ON ERROR GOTO REDMOND

Re: The worst program I ever worked on

#27

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.

That sounds kind of funny. Where do you go on error? One time I had to debug this incredibly obfuscated Word Basic subroutine. It was such a mess of gotos (deliberately so) that the company that wrote it for us thought they had us over a barrel and could charge us like a wounded bull. That is, until I showed my cow-orkers the superior technology of "paper, scissors and sticky tape".

Where do you go on error

Hell, Arizona or any other village with that name. Real C# code can be like this:

    if(John is evil){ goto Hell};
(http://msdn.microsoft.com/en-us/library/scekt9xw%28v=vs.71%2...)

Re: The worst program I ever worked on

#28
I think the best way to guarantee job security is to solve hard problems for the company you work for, and make it visible (i.e., communicate about it). This will gain respect from your peers and give you a reputation of being useful and very worthy keeping around.

Writing some kind of obfuscated code is shooting yourself in the foot - after a while not even you can maintain it. Plus, your peers will notice and probably not like it. This notion will percolate up to management.

Another way to guarantee job security might be when you are the only person able (or willing) to maintain some old legacy system. This carries the risk that if that system is finally scrapped or replaced, your job is being scrapped too ;-)

edit: horrible grammar

Re: The worst program I ever worked on

#29
Worst for me was something I was asked to maintain a little while ago. Was essentially Microsoft Reporting Services implemented in 80,000 lines of VB.NET.

The first thing I did was chuck it into VS2010 and run some code metrics on it. The results follow,

10 or so Methods had 2000+ lines of code. The maintainability index was 0 (number between 0 and 100 where 0 is unmaintainable). The worst function had a cyclomatic complexity of 2500 (the worst I have ever seen on a function before was 750 odd). It was full of nested inline dynamic SQL all of which refered to tables with 100+ columns, which had helpful names like sdf_324. There were about 5000 stored procedures of which most were 90% similar to other ones with a similar naming scheme. There were no foreign key constraints in the database. Every query including updates, inserts and deletes used NOLOCK (so no data integrity). It all lived in a single 80,000 line file, which crashed VS every time you tried to do a simple edit.

I essentially told my boss I would quit over it as there was no way I could support it without other aspects of work suffering. Thankfully it was put in the too hard basket and nobody else had to endure my pain.

I ended up peer reviewing the changes the guy made some time later and a single column update touched in the order of 500 lines of code.

EDIT - I forgot to mention, there was so much nested if code in methods you could hold down page down and it would look like the page was moving the other way, similar to how a wheel on tv looks like its spinning the other way.

Re: The worst program I ever worked on

#30
post #16
post #10

One semester I was TA'ing a certain course all electrical and computer engineering students are required to take. One student named all his variables in phonetic chinese (using the utf8 character set of course). Another student named all his variables after superheros.

For the Chinese guy, I wonder if the code would have been way easy to maintain for the average Chinese developer. That would be an interesting analysis.

I once worked in a Chinese software company on the mainland and often maintained code written by Chinese developers.

I'm Irish and didn't appreciate their comments in Chinese, they didn't appreciate my comments in Irish.

Once that was understood we swapped quickly over to English for all comments / variables / declarations.

Post reply on HN