Spaghetti Towers

post by eukaryote · 2018-12-22T05:29:47.551Z · score: 90 (39 votes) · LW · GW · 17 comments

This is a link post for https://eukaryotewritesblog.com/2018/12/21/spaghetti-towers/

Here’s a pattern I’d like to be able to talk about. It might be known under a certain name somewhere, but if it is, I don’t know it. I call it a Spaghetti Tower. It shows up in large complex systems that are built haphazardly.

Someone or something builds the first Part A.

Later, someone wants to put a second Part B on top of Part A, either out of convenience (a common function, just somewhere to put it) or as a refinement to Part A.

Now, suppose you want to tweak Part A. If you do that, you might break Part B, since it interacts with bits of Part A. So you might instead build Part C on top of the previous ones.

And by the time your system looks like this, it’s much harder to tell what changes you can make to an earlier part without crashing some component, so you’re basically relegated to throwing another part on top of the pile.

I call these spaghetti towers for two reasons: One, because they tend to quickly take on circuitous knotty tangled structures, like what programmers call “spaghetti code”. (Part of the problem with spaghetti code is that it can lead to spaghetti towers.)

Especially since they’re usually interwoven in multiple dimensions, and thus look more like this:

“Can you just straighten out the yellow one without touching any of the others? Thanks.”

Second, because shortsightedness in the design process is a crucial part of spaghetti machines. In order to design a spaghetti system, you throw spaghetti against a wall and see if it sticks. Then, when you want to add another part, you throw more spaghetti until it sticks to that spaghetti. And later, you throw more spaghetti. So it goes. And if you decide that you want to tweak the bottom layer to make it a little more useful – which you might want to do because, say, it was built out of spaghetti – without damaging the next layers of gummy partially-dried spaghetti, well then, good luck.

Note that all systems have load-bearing, structural pieces. This does not make them spaghetti towers. The distinction about spaghetti towers is that they have a lot of shoddily-built structural components that are completely unintentional. A bridge has major load-bearing components – they’re pretty obvious, strong, elegant, and efficiently support the rest of the structure. A spaghetti tower is more like this.

Image from the always-delightful r/DiWHY.

(The motto of the spaghetti tower is “Sure, it works fine, as long as you never run lukewarm water through it and unplug the washing machine during thunderstorms.”)

Where do spaghetti towers appear?

You know those stories about clueless old people who get to their Gmail account by typing “Google” into Bing, clicking on Google in the Bing search results, typing “Gmail” into Google, and then clicking on Gmail in the Google search results?
I am reading about serotonin transmission now, and everything in the human brain works on this principle. If your brain needs to downregulate a neurotransmitter, it’ll start by upregulating a completely different neurotransmitter, which upregulates the first neurotransmitter, which hits autoreceptors that downregulate the first neurotransmitter, which then cancel the upregulation, and eventually the neurotransmitter gets downregulated.
Meanwhile, my patients are all like “How come this drug that was supposed to cure my depression is giving me vision problems?” and at least on some level the answer is “how come when Bing is down your grandfather can’t access Gmail?

I think there are probably a lot of examples of spaghetti towers, and they probably have big ramifications for things like, for instance, what systems evolution can and can’t build.

I want to do a much deeper and more thoughtful analysis about what exactly the implications here are, but this has been kicking around my brain for long enough and all I want to do is get the concept out there.

Does this feel like a meaningful concept? Where do you see spaghetti towers?

17 comments

Comments sorted by top scores.

comment by waveman · 2018-12-22T05:54:15.884Z · score: 12 (7 votes) · LW · GW

See https://en.wikipedia.org/wiki/Big_ball_of_mud

There is a rich literature on design anti-patterns and the reasons they exist and survive.

Agree that biology looks like a classic legacy system, but worse:

3.5B years old

No documentation

No source code

comment by avturchin · 2018-12-23T11:55:03.467Z · score: 9 (4 votes) · LW · GW

Also "Normal accidents" by Perrow may be relevant: spaghetti towers have some natural rate of crashes, not too often, as this will not allow them to be built so high, but also not very rare, as they are not designed to be stable.

comment by habryka (habryka4) · 2019-02-05T22:06:38.188Z · score: 8 (4 votes) · LW · GW

Promoted to curated: I've wanted to curate this for a while, mostly because it introduces a concept in a nice and concise way, while also connecting it to existing concepts and scientific disciplines. I've also found the images pretty useful and good, and I do think we have a lack of images, and see this as a good example of low-effort images increasing the quality of a post by a lot.

comment by Martin Sustrik (sustrik) · 2018-12-22T06:12:07.866Z · score: 8 (7 votes) · LW · GW

“Can you just straighten out the yellow one without touching any of the others? Thanks.”

https://en.wikipedia.org/wiki/Recurrent_laryngeal_nerve#Evidence_of_evolution

comment by MakoYass · 2018-12-24T21:25:38.338Z · score: 7 (3 votes) · LW · GW

Suddenly very inspired with the idea of a programming language where even the most carelessly constructed spaghetti towers are fairly easy to refactor.

I want to design a medium that can be assembled into a fairly decent set of shelves by just progressively throwing small quantities of it at a wall.

I want to design tools that do not require foresight to be used well, because if you're doing something that's new to you, that challenges you- and I want to live in a world where most people are- foresight is always in scarce supply.

comment by sirjackholland · 2019-02-07T21:32:52.189Z · score: 6 (5 votes) · LW · GW

I would call this a good visual representation of technical debt. I like to think of it as chaining lots of independently reasonable low order approximations until their joint behavior becomes unreasonable.

It's basically fine to let this abstraction be a little leaky, and it's basically reasonable to let that edge case be handled clumsily, and it's basically acceptable to assume the user won't ever give this pathological input, etc., until the number of "basically reasonable" assumptions N becomes large enough that 0.99^N ends up less than 0.5 (or some other unacceptably low probability of success). And even with a base as high as 0.99, the N that breaks 50% is only ~70!

The visual depiction of this as parts being stacked such that each additional part is placed in what looks to be a reasonable way but all the parts together look ridiculously fragile is excellent! It really emphasizes that this problem mode can only be understood with a global, rather than a local or incremental, view.

comment by Bucky · 2019-02-11T09:16:17.621Z · score: 3 (2 votes) · LW · GW

I wonder to what extent tax codes are spaghetti towers - every time someone finds a loophole a new bit of tax code gets added to close it without considering how to make a coherent whole. This would explain how the uk tax code runs to >10,000 pages

comment by jmh · 2019-02-12T16:18:20.184Z · score: 4 (3 votes) · LW · GW

Extending that the legislation and law in general seems appropriate as well. I wonder if one contrasts and compares slice of time views of both common law regimes and statutory law regimes if there would be any differences.

comment by Davidmanheim · 2019-02-14T10:20:18.739Z · score: 2 (2 votes) · LW · GW

Having looked into this, it's partly that, but mostly that tax codes are written in legalese. A simple options contract for a call, which can easily be described in 10 lines of code, or a one-line equation. But the legal terms are actually this 188 page pamplet; https://www.theocc.com/components/docs/riskstoc.pdf which is (technically but not enforced to be a) legally required reading for anyone who wants to purchase an exchange traded option. And don't worry - it explicitly notes that it doesn't cover the actual laws governing options, for which you need to read the relevant US code, or the way in which the markets for trading them work, or any of the risks.

comment by jmh · 2019-02-07T16:16:23.526Z · score: 3 (2 votes) · LW · GW

I seem to work (and possible live) in such a setting ;-)

On one level I wonder how much we need to worry. The idea behind that comment is the problem we all face with the asymmetric nature of our knowledge when facing the future. The distinction here is not to say that sloppy planning and maintenance should be consider acceptable but that we can only avoid the spaghetti to some extent. This is not to suggest the author was suggesting that. Only saying we might want to think about where the margins of efficiency are.

I was also wondering if some of the innovations in graph theory might help manage decision-making in a spaghetti world. The idea of a programming language that can help refactor the spaghetti might use such tools.

The last (actually first but...) thought I had was "Hello Gordian Knot."

comment by B-N-O · 2019-02-06T10:06:42.117Z · score: 3 (3 votes) · LW · GW
Where it would theoretically be nice if every function was neatly ordered

...but another problem is this: when you build a bridge, you know in advance what you need and what you don't. Nobody (sane) will demand that you add a platform for selling Coca-Cola and a pier at the bottom with an elevator to ground level,and whatnot mid-construction. In programming, you either work for military where you will get proper specification several inches thick, or you start developing and try to accommodate for sudden requirement changes on the fly. Good programmer is better at predicting which changes are more likely and designs their code so that those are relatively easy to implement. But when redesigning from scratch is not an option and refusing to change is not an option - spaghetti tower becomes the most viable option left.

comment by quanticle · 2018-12-23T18:30:12.365Z · score: 3 (2 votes) · LW · GW

Meta note: the actual link URL (https://www.lesswrong.com/out?url=eukaryotewritesblog.com%2F2018%2F12%2F21%2Fspaghetti-towers%2F) results in an error when I click on it.

comment by habryka (habryka4) · 2018-12-23T20:58:36.738Z · score: 3 (2 votes) · LW · GW

Fixed it manually. The url specified didn't have a www or an http at the beginning, which means it was interpreted as a relative URL. Not sure what I want the behavior to be here, since sometimes we do want relative URLs. Will probably just start paying attention to it and fix it whenever I see someone accidentally adding a relative URL, and if it starts happening often will change the default behavior.

comment by Gunnar_Zarncke · 2019-02-06T21:25:44.865Z · score: 2 (1 votes) · LW · GW

The general patterns is

Systems in general work poorly or not at all.

-- https://en.wikipedia.org/wiki/Systemantics

Which also has lots of examples but needs to be taken not too serious.

comment by bubblesort · 2019-02-25T20:53:47.613Z · score: 1 (1 votes) · LW · GW

It seems to me you are talking about levels of entropy. High entropy systems still rely upon the low entropy of universal laws. A computer program routines may be itertwined, wrapped around each other, undocumented, may be a nightmare to understand, but if it works, why fix it? It conforms to the requirements to compile it into a useable executable file. A star that is exploding is like a spaghetti structure. It falls into a state of high entropy but only in as much as universal laws dictate how it will do that. Correct me if I am wrong but are you talking about levels of entropy?

Edited in later:

The kind of entropy I am talking about is a physical state. Imagine you make a building of bricks with a nice kitchen, dining room, etc etc. The building is left to stand for a 1000 years. At first it has low entropy. It is a very definite structure. Over time, roof tiles fall off, the rain gets in, wood rots, bricks crumble. By 500 years it has lost most of its original defining characteristics, it is falling into a state of high entropy. It is becoming a mound of rubble. Pour sand out of a 1000 buckets. At first the sand is shaped by the shape of the bucket, but then when it leaves the bucket that structure is lost. Pouring more sand on the floor, on top of the other sand does nothing to lower the state of entropy. Systems fall into decay. Unravelling the decay, creating some semblance of order brings about a different structure a different level of entropy

comment by Cyclismo · 2019-02-07T23:45:17.789Z · score: 1 (1 votes) · LW · GW

Many automobiles are spaghetti towers. The longer a model or drivetrain is in production, the more spaghetti. I drive a 1985 Volkswagen Vanagon. Its ancestors had horizontally opposed four cylinder air-cooled engines in the rear, like all ancestral VWs. In 1984 the Vanagon got water cooled, but still horizontally opposed four cylinder rear-engine. The plumbing is, as they say, like a submarine. Some later Vanagon models layered onto this concept four-wheel drive and air conditioning. Talk about plumbing.

Of course, most every automobile wiring system grew from simple ignition-lights-radio-heater-fan-windshield-wipers to include airplane-like control panels, wireless entry locks, theft alarms, seatbelt buzzers, seat warmers, electric windows, seats, hatches, sun roofs, and steering-wheel adjusters. I think four fuse panels is the norm now. My modern diesel pickup truck had two batteries, two alternators, and every gizmo in the catalog, layered onto the basic automotive wiring system.