Spaghetti Towers

Link post

Here’s a pat­tern I’d like to be able to talk about. It might be known un­der a cer­tain name some­where, but if it is, I don’t know it. I call it a Spaghetti Tower. It shows up in large com­plex sys­tems that are built hap­haz­ardly.

Some­one or some­thing builds the first Part A.

Later, some­one wants to put a sec­ond Part B on top of Part A, ei­ther out of con­ve­nience (a com­mon func­tion, just some­where to put it) or as a re­fine­ment to Part A.

Now, sup­pose you want to tweak Part A. If you do that, you might break Part B, since it in­ter­acts with bits of Part A. So you might in­stead build Part C on top of the pre­vi­ous ones.

And by the time your sys­tem looks like this, it’s much harder to tell what changes you can make to an ear­lier part with­out crash­ing some com­po­nent, so you’re ba­si­cally rel­e­gated to throw­ing an­other part on top of the pile.

I call these spaghetti tow­ers for two rea­sons: One, be­cause they tend to quickly take on cir­cuitous knotty tan­gled struc­tures, like what pro­gram­mers call “spaghetti code”. (Part of the prob­lem with spaghetti code is that it can lead to spaghetti tow­ers.)

Espe­cially since they’re usu­ally in­ter­wo­ven in mul­ti­ple di­men­sions, and thus look more like this:

“Can you just straighten out the yel­low one with­out touch­ing any of the oth­ers? Thanks.”

Se­cond, be­cause short­sight­ed­ness in the de­sign pro­cess is a cru­cial part of spaghetti ma­chines. In or­der to de­sign a spaghetti sys­tem, you throw spaghetti against a wall and see if it sticks. Then, when you want to add an­other part, you throw more spaghetti un­til it sticks to that spaghetti. And later, you throw more spaghetti. So it goes. And if you de­cide that you want to tweak the bot­tom layer to make it a lit­tle more use­ful – which you might want to do be­cause, say, it was built out of spaghetti – with­out dam­ag­ing the next lay­ers of gummy par­tially-dried spaghetti, well then, good luck.

Note that all sys­tems have load-bear­ing, struc­tural pieces. This does not make them spaghetti tow­ers. The dis­tinc­tion about spaghetti tow­ers is that they have a lot of shod­dily-built struc­tural com­po­nents that are com­pletely un­in­ten­tional. A bridge has ma­jor load-bear­ing com­po­nents – they’re pretty ob­vi­ous, strong, el­e­gant, and effi­ciently sup­port the rest of the struc­ture. A spaghetti tower is more like this.

Image from the always-delight­ful r/​DiWHY.

(The motto of the spaghetti tower is “Sure, it works fine, as long as you never run luke­warm wa­ter through it and un­plug the wash­ing ma­chine dur­ing thun­der­storms.”)

Where do spaghetti tow­ers ap­pear?

  • Ba­si­cally all of biol­ogy works like this. Ab­solutely all of evolu­tion is made by throw­ing spaghetti against walls and see­ing what sticks. (More ac­cu­rately, throw­ing nu­cleic acid against harsh re­al­ity and see­ing what suc­cess­fully makes more nu­cleic acid.) We are 3.5 billion years of hacks in frag­ile trench coats.

    • Scott Star Codex de­scribes the phe­nomenon in neu­ro­trans­mit­ters, but it’s true for all of molec­u­lar biol­ogy:

You know those sto­ries about clue­less old peo­ple who get to their Gmail ac­count by typ­ing “Google” into Bing, click­ing on Google in the Bing search re­sults, typ­ing “Gmail” into Google, and then click­ing on Gmail in the Google search re­sults?
I am read­ing about sero­tonin trans­mis­sion now, and ev­ery­thing in the hu­man brain works on this prin­ci­ple. If your brain needs to down­reg­u­late a neu­ro­trans­mit­ter, it’ll start by up­reg­u­lat­ing a com­pletely differ­ent neu­ro­trans­mit­ter, which up­reg­u­lates the first neu­ro­trans­mit­ter, which hits au­tore­cep­tors that down­reg­u­late the first neu­ro­trans­mit­ter, which then can­cel the up­reg­u­la­tion, and even­tu­ally the neu­ro­trans­mit­ter gets down­reg­u­lated.
Mean­while, my pa­tients are all like “How come this drug that was sup­posed to cure my de­pres­sion is giv­ing me vi­sion prob­lems?” and at least on some level the an­swer is “how come when Bing is down your grand­father can’t ac­cess Gmail?
  • My pro­gram­ming friends tell me that spaghetti tow­ers are near-uni­ver­sal in the code­bases of large com­pa­nies. Where it would the­o­ret­i­cally be nice if ev­ery func­tion was neatly or­dered, but ac­tu­ally, the thing you’re work­ing on has three differ­ent de­pen­den­cies, two of which are un­main­tained and were aban­doned when the guy who built them went to work at Google, and you can never be 100% cer­tain that your code tweak won’t crash the site.

  • I think this also ex­plains some of why bu­reau­cra­cies look and act the way they do, and are so hard to change.

I think there are prob­a­bly a lot of ex­am­ples of spaghetti tow­ers, and they prob­a­bly have big ram­ifi­ca­tions for things like, for in­stance, what sys­tems evolu­tion can and can’t build.

I want to do a much deeper and more thought­ful anal­y­sis about what ex­actly the im­pli­ca­tions here are, but this has been kick­ing around my brain for long enough and all I want to do is get the con­cept out there.

Does this feel like a mean­ingful con­cept? Where do you see spaghetti tow­ers?