Live data from Hacker News

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

news.ycombinator.com

301–310 of 601 posts

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

#301
post #27

Earlier quoted context omitted.

At least there are tests!

Tests that run for 30 hours is an indication that nobody bothered writing unittests. If you need to run all tests after changing X, it means X is NOT tested. Instead you need to rely on integrations tests catching Xs behavior.

Always test "outside-in", i.e. integration tests first, then if you can afford it, unit tests.

Integration tests test those things you're going to get paid for... features & use-cases.

Having a huge library of unit tests freezes your design and hampers your ability to modify in the future.

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

#303
post #260

I was given the opportunity to work with iOS at one of my former employers and I quickly agreed (I was a backend developer back then). It was a rather popular application at a rather large Austrian media company, with around 50k unique monthly users. Boy did I regret that decision! - 100KLOC - Initial development outsourced to India. Comments, variable names in Indian. - Subsequent development outsourced to Belarus.…

You were "given the opportunity" huh? :) How long did you work on that before you threw in the towel?

About six months. I managed to actually get a new feature into that hot mess while fixing bugs that would take days to weeks to track and handling compatibility with a new iOS major version, but then I got an offer to work in the space industry and quickly left.

A while later I heard they threw everything away and started an in-house rewrite in Swift. Some people do seem to learn from their mistakes.

EDIT: clarification on the opening statement.

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

#304
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 feel like you could make a huge chart on the wall showing the epochs and what the previous developer didn't know at that time. Like "why would it be done this way? Ah 1997, let's see on the chart... Ah right, Greg doesn't know SQL here"

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

#305
post #251

Earlier quoted context omitted.

Really surprising considering that Oracle is the standard for serious enterprise databases. Not really surprising when you consider Oracle's other bug ridden offerings (probably not as thoroughly tested). Makes me fear for Oracle 18c.

Totally unsurprising if you've ever worked with Oracle. The layers upon layers of legacy cruft are plainly visible even in simple things like the GUI installers.

I remember an oracle forms product based product I helped develop to install on end users pc's required several oracle products installing - which meant 14 or 15 Floppy disks to be used in the right order.

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

#306
ADP Retirement Services first generation of PES (Plan Entry System) program. It was/is an internal tool with all the horror stories that you hear about internal tools. The people who made it wrote obscure logic with encrypted variable naming with the main purpose of having job security, it's a core tool in their business model but treated like gutter trash, built with visual basic and embedded angular code to make it look more modern, the supposed rewrite talk went on for 8 years, and to put icing on the top it was QAd/maintained by underqualified offshore old-school contractors (you cant even call this group devs/engineers).

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

#307
My own! For a university assignment we had to make a simple Excel clone as a group.

We divided the work and I ended up working on the formula parser. I spent a week thinking about it and couldn't figure it out (I wanted to work it out from scratch). Eventually I had a flash of insight: I know how to parse simple formulas, so I can use string replacement to recursively rewrite a formula until I can parse it.

By the time I had written all of it, I didn't understand how it worked anymore, but it did work!

FormulaParser ended up being longer than the rest of the codebase combined, and I eventually learned the other groups did it with a regex and ~50 LoC...

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

#308
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 recall a civil engineering suite of programs that had been converted from Basic into Fortran IV.

The basic was so old it only had two (yes two) character variables - the Fortran code made liberal uses of Arithmetic IF staements !!!!

An example of one is IF (S12 - 1.0) 13, 13, 12

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

#309
post #291
post #284

Earlier quoted context omitted.

It's a good exercise to imagine how the job would be sold. Things like this would definitely not come up in the interview process, instead they would sell you on "you get to work on a cutting-edge db kernel that is running most of the Fortune 100s" or sth like that, which is true (!), but doesn't describe the day to day. The best way to guess this is to extrapolate from the interview questions. If they ask you a lot…

On the contrary, the interview was an ordinary one. The screening round consisted of very basic fizzbuzz type coding ability checks: Reversing a linked list, finding duplicates in a list, etc. Further rounds of interviews covered data structure problems (trees, hashtables, etc.), design problems, scalability problems, etc. It was just like any other interview for software engineering role.

Were you even given substantial time to ask the interviewers questions? In most interviews I’ve done, even later round interviews whether it’s a finance company, start-up, FAANG, and companies of all sorts in between, I was given at most 5 minutes to ask questions after some dumb shit whiteboard algo trivia.

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

#310
When I took over my current job a outsourcing company who employed developers based in Islamabad (Pakistan) wrote most of the code. It's C#, they didn't understand the concept of null, by ref or by value.

It was interesting. The database was Mongo and they had some horrible Entity Framework port that they forked on Github and used which wasn't maintained and at the time in 2015, 3 years old.

The data layer had business logic. Let's say they were getting a user record from the database but they didn't want to include the first and last name they'd write a method called

GetUserWithoutFirstAndLastName();

That would be in the User repository. Another requirement would come up to get the user but not include the user's language for instance and they'd create another method

GetUserWithoutFirstAndLastNameAndLanguage();

Ended up with about 70 or so methods which basically gave different levels of hydration for the User object.

The frontend was written in Extjs which took about 25 seconds to load.

They had no tests.

Post reply on HN