Hacker News new | ask | show | jobs
by srajabi 1119 days ago
No abstractions turns to spaghetti Too many abstractions turns to spaghetti

I don't think the answer is one or the other at all like the blog post is implying. I think his previous conclusion of a threshold makes more sense. Perhaps though they have chosen the wrong abstractions and hence the confusion

4 comments

The thing is, even if its spaghetti, I can follow the individual noodles. I can carefully pull them out of the pile and lay them out all neat and separated.

With "cleverely abstracted" code, I cannot do that. Because there are no noodles any more. There are small pieces of noodles, all in different sizes, spread out over 200 plates, that reside on 140 tables in 40 different rooms, some of which are in another building. And there are now 20 types of sauce, and 14 types of parmesan, but those are not neatly separated, but spread evenly all over everything, and so it all tastes awful. And each individual plate still manages to be spaghetti.

Okay, yes, I may have strechted out the food-analogy a bit.

But that's pretty much how I feel when digging through over-engineered codebases.

I usually hear lasagna code if it's got too many codes, and ravioli code if it's too packetized.
First time Im hearing of ravioly but I like the analogy
But hey, it's serverless and scales to zero.

And some guy banged it out over the weekend, which means he's a rock star.

"we can never let him go, we'd be lost without him!"
Sounds like we worked at the same place
Nobody else can match (understand) his velocity. He's the best.
I loved the “I can follow the individual noodles”. Yes, sometimes even simple spaghetti is better than spagetti tower lassagnia but it’s still too slippery to reason through. But I do get the part about being able to at least grasp it, slippery as it is…
Ad absurdum then you can program in assembly just fine, right? Can I dump you chrome’s assembly output? It’s all trivial, just movs and whatnot.
Laying the spaghetti out neatly is, I think, the correct level of abstraction. Identify each noodle, separate it, put it in the right place and make sure they’re all in the correct order. You don’t want noodles zig zagging and crossing over each other everywhere. You want nice clean lines of noodles you can easily follow from start to end and as few of them as possible.
Yes, it's just the new style of spaghetti, this time with lipstick and a bow tie.

One notable difference is that now the GOTOs are implicit and only in your head, so it's notably even harder to comprehend than the old style of spaghetti.

Also often adds in some code hidden in comments ('annotations'), some squirreled away in complex configuration files, and some other code where what actually gets executed depends on concatenated string variables, and maybe for good measure some places where which code gets executed (and how) implicitly depends on the filepath it is under, and now we have a mess even a debugger can't help with.

It's nice to see more people finally getting disillusioned with these trends.

>No abstractions turns to spaghetti Too many abstractions turns to spaghetti

That's because abstraction is a myth perpetuated by the likes of Sussman (ie academics that never wrote real code) and in reality the only thing that matters is PSPACE ⊆ EXPTIME.

One could argue there are different degrees of ugly and beautiful spaghetti though.