What is the Pasta Theory of Programming?

Malcolm Tatum
Malcolm Tatum

The pasta theory of programming has to do with the complexity of various programming structures. Just as pasta comes in many different sizes and shapes, the same is true with programming code. With a pasta theory, a particular type of pasta is used as a colorful illustration to identify some aspects associated with a particular set of programming protocols.

The pasta theory of programming compares different ways of programming to different noodles.
The pasta theory of programming compares different ways of programming to different noodles.

One excellent example of a pasta theory of programming is the spaghetti code. Cooked spaghetti is often served as a collection of strands that cross over and intertwine with one another. It is practically impossible to extract one strand of spaghetti without causing some degree of disturbance to the other strands.

With this type of pasta theory, it is understood that the programming effort is somewhat happenstance and chaotic. There is little or no real structure to the programming code. The end result is that attempting to modify the code associated with one portion of the sequence often creates unanticipated problems with another part of the code. As a result, a spaghetti code is extremely hard to understand in terms of logical progression and equally difficult to modify without creating new problems.

By contrast, the pasta theory of programming can also refer to programming that is highly structured. One example of this type of theory is known as the lasagna code. Lasagna is a layered pasta dish, with ingredients placed deliberately and consistently between the layers of lasagna noodles. The end result is a pasta dish that is uniform throughout and is easily broken down into identifiable components.

When the pasta theory or programming uses the term lasagna code to refer to a programming effort, it is spotlighting the logic and order that appears to govern the entire structure of the code involved. It is possible to modify sections of the code without creating an unanticipated reaction somewhere later in the code processing. Logical progression and sequencing are hallmarks of a lasagna code, making it an opposite of the more chaotic spaghetti code.

The concept of the pasta theory of programming is typically attributed to Raymond Rubey. In a letter he wrote to a trade magazine in 1992, Rubey used terminology related to ravioli and spaghetti to refer to programming strategies and situations. The general idea of a pasta theory of programming caught on and soon various programming methods began to be labeled by many programmers using various types of pasta. In some cases, the selection of pasta names pointed toward beneficial attributes of a given programming code approach, while others referred to programming methods that were considered to be less efficient and structured

Malcolm Tatum
Malcolm Tatum

After many years in the teleconferencing industry, Michael decided to embrace his passion for trivia, research, and writing by becoming a full-time freelance writer. Since then, he has contributed articles to a variety of print and online publications, including EasyTechJunkie, and his work has also appeared in poetry collections, devotional anthologies, and several newspapers. Malcolm’s other interests include collecting vinyl records, minor league baseball, and cycling.

You might also Like

Discuss this Article

Post your comments
Forgot password?