Hacker News new | ask | show | jobs
by exDM69 5019 days ago
Another pasta-flavored programming problem is "ravioli code". That kind of code has abstraction layers for everything and stuff is forced into objects and classes when all that's needed is a simple function or heck, even a goto statement. Code like this may seem elegant to the author but trying to read it is as futile an exercise as going through a pile of spaghetti code.

Given the popularity of OOP during the past few decades, ravioli may be a bigger problem than spaghetti these days.

5 comments

Onion code: as you peel back the layers your cry more.
I think the article is trying to define what you call ravioli code as a modern version of spaghetti code. But I think ravioli is a handier, more specific name. Is it your coinage?
No, I read about it somewhere years ago. Don't know the origin of the term, but googling for the term gives several links.

The wikipedia page for spaghetti code actually has several pasta examples: spaghetti, ravioli, lasagna and spaghetti with meatballs!

http://en.wikipedia.org/wiki/Spaghetti_code

Sure, ravioli code can be a problem, although you are supposed to be aggressively refactoring away trivial classes. Perhaps my experience is different to yours, but I've encountered "under-object oriented" code far more often than "over-object oriented". I guess it's based on the format of complexity you're used to - some people like their 20K LOC "classes". I prefer mine in the 100 to 500 LOC range, even if that results in "too many" classes.
To stay on culinary metaphors, I would call lasagna code any properly architected code base where a few layers neatly face each other with evenly spread meat in between.
And then there is baklava code[1], with too many thin, fragile, porous layers.

[1] http://www.johndcook.com/blog/2009/07/27/baklav-code/

Never heard of it.