Pasta is one of my great food weaknesses. In my world, there are few dishes that can compete with a good plate of thin spaghetti with a home made tomato sauce. That’s why I was so happy to hear my coworkers talking about spaghetti … code!
Typical software development follows a brute force development strategy, where the functionality of the software is expected to be proportional to the amount of development effort.
Managers are usually anxious to see results as soon as possible. They expect to see ongoing progress to justify their investment. As the software increases in complexity, continued development will gradually become more difficult and also more expensive.
When a section of code has problems or bugs, rather than rewriting the entire section, a developer will often add some kind of workaround. Over time, these workarounds (or hacks), start building up on top of each other. Eventually the code becomes incomprehensible – it starts to resemble spaghetti.
Developers who have the “fortune” to deal with legacy code know very well the term spaghetti. It’s long. It´s pretzled. If you pull one part of spaghetti, half of what’s on your plate moves. There can be many unexpected tastes, in terms of what can be mixed in. Read more about dealing with legacy code and pasta …
As the source code continues to spaghettify, the amount of time and effort required to add new features becomes greater and greater until eventually it reaches the spaghetti limit.
The common solution to spaghetti code is also well known: object oriented programming (OOP). Of course, in practice this is more an ideal than reality. Still, OOP can help a lot to separate large code bases into smaller, more maintainable chunks.
In terms of pasta coding I would like to mention one more metaphor: Ravioli code. Ravioli code specifically uses the analogy of the small squares of filled pasta pieces to describe a large number of small, separate code modules that work together to accomplish a greater objective in a program’s source code. Overall, a great number of coders feel that ravioli code is neither innately good or bad, and should be considered on a case-by-case basis.
Conclusion: It doesn´t matter if it is spaghetti, lasagna or ravioli; just call some good friends or family, prepare a nice home made sauce and have a good time!