Live data from Hacker News

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

news.ycombinator.com

201–210 of 601 posts

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

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

Like reading the journal you found in the abandoned house you just moved in and it belonged to the previous kid that used to live there. Sounds like a movie.

Oh yeah it might be commedy where two people argue about spaces vs tabs and there come our function of 20k lines in single block of code that never heard about using any of those... nor about moving repeated code to own function.

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

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

what kind of problems do you cause at a construction site that do not get you fired but reassigned to Programmer with programming 101 book?

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

#203
post #62

Earlier quoted context omitted.

A sentiment among members of a former team was that automated tests meant you didn't need to write understandable code - let the tests do the thinking for you. This, and stuff like your story, are why I don't trust people who promote test-driven development as the best way to write clean APIs.

TDD doesn't think for you, it merely validates your own existing understanding/mental model and forces you to come up with it upfront. This is hardly a thing to be mistrustful about, unless you work with idiots.

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

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

#204

The project around 10 million lines of code. Some of it was written in a very specific version of Fortran that was a PITA to compile. One fun experience was opening a file and seeing it was created on my birthday. Not in the sense just matching the day and month of my birtdhay. The code was literally written on the day I was born.

> The code was literally written on the day I was born.

That made me LOL.

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

#205
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.

It could also be that the flags are so tangled together that a change to one part of the system can break many other parts that are completely unrelated. Sure you can run a unit test for X, but what about Y? Retesting everything is all you can do when everything is so tangled you can’t predict what a change could effect.

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

#206

Earlier quoted context omitted.

TDD doesn't think for you, it merely validates your own existing understanding/mental model and forces you to come up with it upfront. This is hardly a thing to be mistrustful about, unless you work with idiots.

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

Touché!

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

#207
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.

How about XS Max =]]

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

#208
post #199

A customer-facing dashboard. Yes, a dashboard. How bad can a dashboard be bad you ask? Well, for one, the dashboard had tabs, and each tab was a separate webapp hosted on a separate server. And each team was responsible for developing and maintaining the webapp that their team was incharge of (i.e the User team in charge of Users webapp, Feature1 team incharge of Feature1 webapp). Now add on the fact that different t…

To some extent this sounds like Spotify. I have been told it's basically Iframes stitched together, and each frame is owned by a team [0] , I do think Spotify has some better auth communication though. 0: https://www.quora.com/How-is-JavaScript-used-within-the-Spot...

Aha! This is the Spotify model!

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

#209
I was in an outsourcing team working for Panasonic door-phone system, the source code was big, but what my team 's done was to develop some more functionalities including video call. It was about ~20 KLOC written in C for the UI & stuff (what we were ordered to do, since the behind layer was not disclosed to us). The source code was a mess since it's written by low-experienced programmers and even intern students. Later I quit that job :)

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

#210
post #62

Earlier quoted context omitted.

A sentiment among members of a former team was that automated tests meant you didn't need to write understandable code - let the tests do the thinking for you. This, and stuff like your story, are why I don't trust people who promote test-driven development as the best way to write clean APIs.

Rich Hickey called it guard rail driven programming. You'll never drive where you want to go if you just get on the highway and bump off the guard rails.

Except that's a really bad analogy. It's more like you set up guard rails, and every time your vehicle hits a guard rail you change the algorithm it uses for navigation until it can do a whole run without hitting a guard rail.

I've experienced myself how the code quality of proper TDD code can be amazing. However it needs someone to still actually care about what they're doing. So it doesn't help with idiots.

Post reply on HN