Live data from Hacker News

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

news.ycombinator.com

111–120 of 601 posts

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

#111

Earlier quoted context omitted.

"Don't touch this" around the main loop can mean being able to make promises about responsiveness, reliability, etc. Frequently there are critical code sections where it is much easier to tell people "don't touch it" rather than training people how to work on it safely.

When that is the case, would it not also be a really good place to explain why not, or provide a link to the place where such an explanation is provided?

It is important to point out that most computer systems are running non deterministic operating systems.

For example, code running in JVMs on top of non deterministic operating systems sometimes behaves in really odd ways. Sometimes a main loop is stable for reasons nobody understands.

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

#112

My first job was sysadmin of a third tier ISP back in the dialup days. The account management and provisioning system that ran EVERYTHING was probably close to 100k lines of csh. Everything was done via a UI that the shell generated as a sort of curses-style interface. What was horrible about it was that it controlled everything from who got a website, active domains, what POPs users could dial into, metered billing,…

This is incredible. Terrifying, but incredible.

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

#113
post #62
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…

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.

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

#114
post #62
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…

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.

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

#115

Earlier quoted context omitted.

> an elevator is a precisely defined problem Ha! As a mechanical engineer, no, nothing in reality is ever precisely defined. Consider that every single part in the elevator has a tolerance: none of the parts are exactly the same in every elevator. Did you account for thermal expansion? What about wear? Fatigue? > Software is never like that — it’s dynamic and constantly changing throughout the life cycle of the softw…

> with software, it almost never works perfectly no matter how much time passes. There is a person inside me -- whenever this is said -- that wants to shout "No! You can prove correctness of your program!". But this complicates the issue even more, since afaik no elevator's correctness is proven but it just works. Mechanical stuff somehow just magically work without proof whereas it's still debatable if proven softwa…

Turns out physical reality is robust in ways code written by mere mortals can only dream of.

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

#116

Earlier quoted context omitted.

When that is the case, would it not also be a really good place to explain why not, or provide a link to the place where such an explanation is provided?

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.

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

#117

We have absolutely no idea how to write code. I always wonder if it's like this for other branches of engineering too? I wonder if engineers who designed my elevator or airplane had "ok it's very surprising that it's working, let's not touch this" moments. Or chemical engineers synthesize medicines in way nobody but a rockstar guru understands but everyone changes all the time. I wonder if my cellphone is made by mac…

It's because software that solves the problem the business intends to solve, and can be maintained without unreasonable time and effort, is good enough. Code readability and maintainability problems are not business problems unless they impact developer productivity to the extent that feature development becomes too slow to tolerate.

After all, if work inside the codebase does not make a difference to the people who use the software, in terms of reliability or features, is it really worth doing?

The trick is to find a balance where efforts to improve code quality actually improve outcomes for the business and the users -- otherwise it's not justifiable to take time away from feature development, which is what the users actually care about.

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

#118

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…

This site/paper isn't actually (entirely) in jest and tries to explore that exact question: http://www.laputan.org/mud/

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

#120

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…

Linux kernel is massive and has been around for decades now and it’s probably millions of lines.

It certainly has a lot of cognitive overhead since you need to always keep in mind the context in which the code you are writing will be running (to reason about concurrency etc.), but it’s relatively easy to understand and well written.

Post reply on HN