Live data from Hacker News

Ask HN: What's the largest amount of bad code you have ever seen work?

news.ycombinator.com

211–220 of 601 posts

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#211
post #8

Bad is not a good measure. But taking 'bad' to mean large, convoluted, zero documentation; I was once at a financial services company that had a 25 million+ LOC mainframe cobol application that had been under active development since 1969. This was a batch and CICs system. It was spaghetti on every level; database (db2, vsam, isam), the screens of the app, the batch jobs, the cobol. It was truly astounding. It was al…

Sounds like a market opportunity. What vertical market is this, more specifically?

Market opportunity? Sounds more like the best way to throw away your sanity. Some things are just beyond repair.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#212
post #172

Earlier quoted context omitted.

In reality there often isn't time. Getting it done > Getting it done properly as far a management is concerned.

Ever had this discussion with a coworker? Coworker: "I hadn't enough time to do it right" You: "Given enough time, how would you do it differently?" Coworker: "............" (crickets) IMHO it's not related to deadlines only ; the "not enough time" argument is often a comfortable fallacy, keeping us from facing the limits of our current skills. I found it to be especially true with testing. I've lost the count of how…

>I found it to be especially true with testing. I've lost the count of how many times I heard "we didn't had time to write (more) tests". But testing is hard. And when given enough time, these developers don't magically start doing it "right" overnight.

Bingo. It's not necessarily only skills though. It can be myriad reasons and "no time" is just the easiest excuse they can think of. In big companies I've often seen the company process prescribing such bad tools that a good TDD testing strategy is impossible to do with those tools, but they won't move away from them, because somebody in purchasing already bought 10,000 licenses for this bad tool (which is often just a bad GUI, which doesn't really help, except for selling the thing).

The worst tool was a bad GUI where you couldn't even define functions you want to use, that had slow (>1h), non-deterministic, test execution, for a unit test.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#213
All code is bad and Google puts almost everything in one repository, so I'm going to say that ;-).

For more traditionally defined bad code, I worked with a team that rewrote an existing service from scratch using with 40000 lines of spaghetti. The service that it replaced was 80000 lines, and was replaced despite working perfectly fine because it was a total clusterfuck with dependencies interwoven across every service anyone had ever heard of. This was a payments system for a major online retailer. All of this code has been removed since.

I also used to participate in Java4k, a competition to make games fit in 4 kilobyte jar files. Writing almost everything inside a while loop in a single function is basically table stakes for that.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#214
I worked for a company that makes sortation devices (conveyors etc), and i inherited an old product from a previous colleague.

The software was largely a standard base with modifications done for the individual customer to suit their business needs.

In this particular project, it was a batch sortation, meaning we received a large batch file from their mainframe, which would then be parsed and executed by the controller software.

Everybody feared this particular project, and estimates on new functionality were sky high, but I didn't think much of it until i had to modify the batch parsing code. I was met with 22000 lines of C code in a single function. This single function was modified multiple times each year, usually adding more code in the process.

It took me the better part of a month to refactor into "manageable" chunk sizes, and in the end i was left with a 1700 LOC function that was still "too big", but nobody really understood how it worked, and we couldn't test it, so i just left it at that.

After my refactor could implement new functionality somewhat faster, but in the end it was still a very complex algorithm, so despite being in smaller functions, you still had to be very careful when modifying it.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#215
post #168

I am maintaining one application in construction industry space. That application was created 25 years ago by construction worker that never wrote single line of code before, but because he caused a lot of problems on construction site they give him Programming 101 book and let him build it. 15 years later the app was close to half milion lines long of huge bowl of spaghetti code. Only comments in whole codebase were…

I have to salute this construction worker for building a solution that is apparently so valuable for the business that they can’t simply replace or rewrite it. This probably means that it solves a real problem for them, and adding 30.000 lines of code per year without any formal training or much tooling is no small feat either. I understand the criticisms and laughs here from the “real” software developers, but damn it’s just impressive what people can create on their own given enough time and motivation.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#216
post #168

I am maintaining one application in construction industry space. That application was created 25 years ago by construction worker that never wrote single line of code before, but because he caused a lot of problems on construction site they give him Programming 101 book and let him build it. 15 years later the app was close to half milion lines long of huge bowl of spaghetti code. Only comments in whole codebase were…

This sounds quite awesome, terrible, and he sounds like he was jumping into a very deep end. Quite sad that he seemingly didn't have someone to tutor/mentor him moving to this role. Given that it worked, and there was a learning curve as you described, over a decade, he seems to have had some big amount of determination to get things to work.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#217

All code is bad and Google puts almost everything in one repository, so I'm going to say that ;-). For more traditionally defined bad code, I worked with a team that rewrote an existing service from scratch using with 40000 lines of spaghetti. The service that it replaced was 80000 lines, and was replaced despite working perfectly fine because it was a total clusterfuck with dependencies interwoven across every servi…

> I worked with a team that rewrote an existing service from scratch using with 40000 lines of spaghetti. The service that it replaced was 80000 lines, and was replaced despite working perfectly fine because it was a total clusterfuck with dependencies interwoven across every service anyone had ever heard of.

Your post should be at the top of the thread. Rewriting projects from scratch tend to do more harm than good, and the only reason this problem isn't addressed very often os that the people invested in reinventing the wheel don't admit to having caused more problems than they solved, and the ones who developed the old systems have moved on and thus are unable to say anything in their defense.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#218
My codebase I'm working on right now. Went from a proof of concept demo, to small mini game, to a bigger mini game, to full game, to SAS product. With no time(budget) to rewrite it up until delivery to a customer. Its pretty frustrating, as its my fault, but budget and tight deadlines forced my hand.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#219
I came here was about to complain about some projects of my previous companies. But reading this thread makes me feel ashamed for getting angry with them, compare to how much more pain you guys went through.

Thanks for all the sharing. Young devs (like me) should really read and appreciate this thread.

Post reply on HN