<img alt="" src="https://secure.365smartenterprising.com/789934.png" style="display:none;">

Keith Eisenhauer

Spaghetti Code: How to Avoid Getting Lost in the Sauce

When I look at a strand of spaghetti on my plate, I really cannot figure out where it started or where it ends. It can be unraveled, but with the sauce, cheese, and meatballs in my way it would be time consuming and, probably, an awful mess. While it may be tasty, it lacks structure. This lack of organization and structure is where spaghetti code derives its name. Badly formed code is usually discovered when there is some need to modify it: an upgrade of the code due to an operating system change, a new feature request, or troubleshooting a bug in the overall operation of the application.

To speak of spaghetti code on the factory floor is unusual as most process control systems work with configurations, not code. Occasionally, an end user may have need that calls for a large software development effort or a project may require a custom application to provide a complete solution.

When presented with such a need how do we make sure that code is well organized, easy to maintain, and that we can see all of the strands, from beginning to end? Here’s how: