Live data from Hacker News

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

news.ycombinator.com

321–330 of 601 posts

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

#321
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've quickly realized that there is never enough time.

If anyone feels that there is enough time then (depending on the position dev/manager/client/etc) he starts slacking, moving focus, moving deadlines, moving staff, demanding more features/support/documentation or new requirements analysis, start being pissed more about smaller bugs.

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

#322
post #9

I'm guessing by bad, you mean ugly. I'm fairly convinced there is no "good" code, or that it's such a minuscule subset that you'll never likely encounter it in your career. Every year I look back on last years stuff I've written, and I can find ten ways to clean things up. In my opinion, if it works, and provides the utility it was designed to bring, then it doesn't matter. If it makes money, then who really cares!

[deleted]

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

#323

Earlier quoted context omitted.

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

This is a complete fallacy IMO. The time is 10 fold down the line when people are attempting to reverse engineer in order to maintain it.

LOL.

The long as short of it as a contractor I have to get it done. It will be probably me making the changes later and I make sure I put these things called comments in.

Also developers pretending code quality is an either or proposition is a false dichotomy. You can write 80% of it in a correct manner and the other 20% could be just hacks to get it done in time. You can't write the perfect system.

So I am sorry you are the one being fallacious.

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

#324
post #158

Earlier quoted context omitted.

> Presumably, down the road, you'll either be a defunct company or doing well enough to afford 10 times the manpower to fix things. Only in startup land which is still a small fraction of our industry. Most places will never have 10 times the manpower to fix things and are hurting themselves by not doing them properly in the first place. > Facebook was a spaghetti code mess in the beginning. I'm sure it caused them s…

Notably, MySpace is often cited as a company that failed because their codebase was terrible, which prevented them from adding features as quickly as Facebook could (despite having many more engineers at the time.)

I don't believe that for one second considering the hacks that Facebook has had to do around the limitations of PHP.

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

#325
post #291

Earlier quoted context omitted.

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.

I was given 5 minutes to ask questions after each round of interview. That part was ordinary too. That's what most of the other companies do (FAANG or otherwise).

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

#326
post #134

Earlier quoted context omitted.

Presumably, down the road, you'll either be a defunct company or doing well enough to afford 10 times the manpower to fix things. Facebook was a spaghetti code mess in the beginning. I'm sure it caused them some growing pains, but moving too slowly early on would have likely been more costly.

I'm completely opposed to the view that bad craftsmanship is acceptable because of time constraints. You are paying for it very dearly, very soon. It is of the utmost importance to write the best code you can from the beginning, and I don't believe it slows you down very much, if at all. If you've ever seen a software product where something that should take a weekend takes months to get out, it's often not because t…

Well I am sorry but you are deluded.

In almost any industry. You normally have 3 properties you can choose.

1. Fast 2. Cheap 3. Quality

You can only pick two of those e.g. The Apollo Space program chose 1 & 3, however it was insanely expensive but the US beat the Russians.

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

#327
post #97

Earlier quoted context omitted.

> most containing the same duplicated (but subtly changed) blocks I had a similar experience with an offshore company. This was during the early-mid 2000s, at the height of the offshoring era when $10/hour programmers in India were aplenty and everyone felt their job was soon to be outsourced. Turns out, no joke, they were being paid per line of code. Despite having to maintain the heap of crap, I was amazed at the b…

What sorts of techniques did they use? I'm very curious to see/hear examples.

    function isTrue(v) {
      var result;
      result = v;
      if (!isFalse(result == true)) {
        return result;
      } else {
        return isFalse(result);
      }
    }

    function isFalse(v) {
      var result;
      result = v;
      if (!isTrue(result == true)) {
        return isFalse(result); // Tail recursion so this is fine.
      } else {
        return result;
      }
    }

    if (isTrue(myBool) == true) { // TODO: Could this be refactored to isTrue(isTrue(myBool))? 
      return true;
    } else if (isTrue(isFalse(myBool))) {
      return false;
    } else if (isFalse(isTrue(myBool))) {
      return false;
    } else {
      return isFalse(isFalse(myBool));
    }

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

#328
post #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"

Haha that would be amazing!

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

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

Good lord, just reading it can cause panic attack.

It literally gave me a sinking feeling. I’d quit that job on day 0.

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

#330
post #242

Earlier quoted context omitted.

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?

Probably fall from roof few times or was not really handy with hammer or something. The company is quite fascinating, they started around 1945 and during the years they've became small conglomerate. There are three or even four generations workign together and once they like you as a person they will find something for you to do.

Is the original programmer still at the company in any capacity?
Post reply on HN