News for hackers. Stuff that matters.
Re:Don't Be Afraid of Types by icedchai on Saturday March 22, 2025 @02:04PM (#43447466)
OOP eventually degrades into "lasagna" (a play on "spaghetti code".) Layers and layers of complexity like you describe. Once you have enough "layers" it becomes almost impossible to follow what is actually happening.
Re:Don't Be Afraid of Types by samiv on Saturday March 22, 2025 @02:21PM (#43447542)
I don't think this is what lasagna means.

Lasagna is when you have your software organized in layers. In other words instead of having a big ball of mud where A calls B calls C calls A calls C calls B you have layers (like in lasagna) so that A calls B calls C and you keep your code base so that classes/modules/types that are in the lower layer do not depend on or know of the anything above them and the dependencies only go one way.

I love lasagna. It's great (both as design and as food) !

Re:Don't Be Afraid of Types by seanwilson on Saturday March 22, 2025 @03:23PM (#43447960)
Not trying to be funny, but "Ravioli code" might be closer:

https://stackoverflow.com/questions/2052017/ravioli-code-why... https://en.wikipedia.org/wiki/Spaghetti_code#Ravioli_code

A related principle that I don't think is talked about enough is "locality": I'd rather have all the code about one feature in one file or close together, rather than it strewn across files where it's harder to read and understand as a whole. Traditional Java was notorious for being the opposite of this. Traditional HTML+CSS+JavaScript is also very bad for this problem.

Re:Don't Be Afraid of Types by schoen on Saturday March 22, 2025 @03:33PM (#43448039)
I love that there's a serious debate about which pasta shape is the best metaphor for particular software engineering patterns!
Re:Don't Be Afraid of Types by throwaway2037 on Sunday March 23, 2025 @03:04AM (#43451320)

    > Traditional Java was notorious for being the opposite of this.
Is modern Java better? If so, why? Also, what languages do it better than Java and why? Any as old as Java that do it better?
Re:Don't Be Afraid of Types by DeathArrow on Sunday March 23, 2025 @09:55AM (#43452952)
There's Vertical Slice architecture that kind of does this. A feature is in a folder.
Re:Don't Be Afraid of Types by johnisgood on Monday March 24, 2025 @06:19AM (#43459233)
> make navigation through the code for maintenance purposes more difficult.

I have this issue with: Java, Kotlin, Erlang, and Elixir, but especially Java and Kotlin.

Re:Don't Be Afraid of Types by icedchai on Monday March 24, 2025 @09:47AM (#43461035)
I've seen the opposite with Python where there's so much junk in a single file it's also impossible to navigate.
Re:Don't Be Afraid of Types by johnisgood on Monday March 24, 2025 @09:55AM (#43461144)
Yeah, I do not use Python, nor do I have to read much Python code, but it may be difficult to follow, too (OOP in general), just like PHP with lots of classes but I do not mind 5000 LOC PHP code that is fully OOP at least, I probably would if they were in their separate files.
Re:Don't Be Afraid of Types by icedchai on Saturday March 22, 2025 @03:28PM (#43447999)
It may be a poor analogy but I’ve seen it used elsewhere. I didn’t make up the term, though I’ve certainly witnessed it.
Re:Don't Be Afraid of Types by kirkhawley on Saturday March 22, 2025 @07:58PM (#43449700)
ALL code eventually degrades into lasagna.
Re:Don't Be Afraid of Types by icedchai on Sunday March 23, 2025 @12:13PM (#43453870)
This is sadly true!