Live data from Hacker News

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

news.ycombinator.com

391–400 of 601 posts

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

#391
A 10,000-line C++ module for transmitting hundreds of different packets to a radio module from the driver, all cut-pasted copies of the same code with different structure name. Bugridden (bad copy-paste-edit bugs).

I replaced it with an 11-line template.

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

#392
post #60

Ten years ago I was called in to remediate a new web application which had been subcontracted to an Indian development company. The PHP developers who'd put it together evidently didn't know about classes, and each page in the application was hundreds, sometimes thousands, of lines of spaghetti code, most containing the same duplicated (but subtly changed) blocks providing database connectivity etc. Security had not…

10 years ago PHP didn't have classes

Sure it did. Classes in PHP showed up in version 4.0 18 years ago.

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

#393
post #43

From 10+ years ago when I worked at PayPay, webscr (the frontend at the time, where you'd log in) was a total of 2GB of C++ that would get compiled into a 1GB CGI executable, deployed over some ~700+ web servers. Debug versions would never get compiled, as I'm told the resulting file was too large for the filesystem to handle. Apparently a great deal of the code was actually inline XML. They knew this was a bad pile…

I think you meant to say PayPal?

Oh whoops, thank you, yes!

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

#394
post #18

Oracle Database 12.2. It is close to 25 million lines of C code. What an unimaginable horror! You can't change a single line of code in the product without breaking 1000s of existing tests. Generations of programmers have worked on that code under difficult deadlines and filled the code with all kinds of crap. Very complex pieces of logic, memory management, context switching, etc. are all held together with thousand…

I am a current Oracle employee and blame a lot of the mistakes on the overseas development team in india. They are (not all but enough to matter) terrible programmers, but hey when you can throw 10 Indian programmers at a problem for the cost of one American... You can blame your blated mismanaged code base on their management over there. This is likely do to the attrition and generally less talented and less autonomous engineering style.

There is a clear difference between code developed AND maintained in the US vs. code that was developed in India, or code developed in USA and given to Indian developers to manage support. Nothing against Indians, but Ive been around the block and there seems to be a lesser quality of code from that part of the world and companies justifyvit in cost savings.

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

#395

Here's a metaquestion: Is it possible for any codebase to NOT eventually (given enough time) become a crufty pile of garbage? I suspect (but have no real evidence... yet) that SOME of this spaghetti garbage is due to the traits of procedural, OOP, mutable languages. But this would then imply that things like functional-language codebases have much longer lifespans... and I don't have evidence for that... but I'm hopi…

I worked on a about a million line Scala codebase a couple years ago. It started it's life in 2007. The code wasn't the greatest, but because all developers throughout it's lifetime had been militant about functional programming, refactoring it wasn't too difficult. When everything is referentially transparent, you can fix problems pretty easily.

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

#396

Earlier quoted context omitted.

ok but from reading a lot of the comments on HN it sounds like many posters here think that they do work with idiots.

Those idiots probably also think the same, though.

If everyone’s an idiot tbinking they’re surrounded by idiots, then TDD has no hope to ever succeed !

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

#397
post #63
post #58

Earlier quoted context omitted.

What's the problem with "hand-rolled components"? Isn't that pretty much the essence of building non-trivial frontend stuff? Or does this have some special meaning in the Angular world?

Not in the case of components which could easily be replaced with a well-tested and proven solution. Notable among the ones in this project was the date picker - there's a decent number of those available and yet somebody made the decision to hand-roll it. The result was a mess that for some reason had a 300 LOC service as a part of it. Needless to say minimal tests. It was a waste of man-days in a project that was a…

There are a lot of date pickers, however if you have a specific UI and UX to implement, it might not be worth trying wrangle one of them into doing what you need it to do.

There's so many integration points (business logic, i18n/l10n, styling, keyboard navigation, accessibility, etc) that I think it's often easier to write your own. Hopefully now that most browsers support , we can just use that most of the time.

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

#398

Earlier quoted context omitted.

I beg to differ. Having to run the full test suite to catch significant errors is an indication that the software design isn't (very) modular, but it has nothing to do with unit tests. Unit tests do not replace service/integration/end to end tests, they only complement them - see the "test pyramid". I think it's important to point this out, because one of the biggest mistakes I'm seeing developers do these days is re…

(terminology nazi mode) "... is an indication that the software design isn't (very) decoupled ". You can be modular without being properly decoupled from the other modules.

But then are your modules really modular?

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

#399
post #18

Oracle Database 12.2. It is close to 25 million lines of C code. What an unimaginable horror! You can't change a single line of code in the product without breaking 1000s of existing tests. Generations of programmers have worked on that code under difficult deadlines and filled the code with all kinds of crap. Very complex pieces of logic, memory management, context switching, etc. are all held together with thousand…

Sounds like a way an reinforcement learning algorithm could write code.

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

#400
post #18

Oracle Database 12.2. It is close to 25 million lines of C code. What an unimaginable horror! You can't change a single line of code in the product without breaking 1000s of existing tests. Generations of programmers have worked on that code under difficult deadlines and filled the code with all kinds of crap. Very complex pieces of logic, memory management, context switching, etc. are all held together with thousand…

The notion of tests that take 20 hours blows my mind. The notions of tests written in C that take 20 hours I can't even fathom.

I'm going to guess a lot of these are integration tests, not unit tests (simply going off execution time).

At that point, for DB testing, I doubt it matters what language test are written in, it's going to be mostly about setting up and tearing down the environment over and over.

Post reply on HN