Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is spaghetti code? [closed]

Can you post a short example of real, overdone spaghetti code, possibly saying what it does? Can you show me a little debugger's nightmare?

I don't mean IOCCC code, that is science fiction. I mean real life examples that happened to you...

Update

The focus has changed from "post some spaghetti code" to "what is exactly spaghetti code?". From a historical perspective, the current choices seem to be:

  • old Fortran code using computed gotos massively
  • old Cobol code using the ALTER statement
like image 667
Federico A. Ramponi Avatar asked Oct 12 '08 14:10

Federico A. Ramponi


People also ask

What causes spaghetti code?

Spaghetti code is a pejorative phrase for unstructured and difficult-to-maintain source code. Spaghetti code can be caused by several factors, such as volatile project requirements, lack of programming style rules, and software engineers with insufficient ability or experience.

What is spaghetti code?

Spaghetti code is a pejorative piece of information technology jargon that is caused by factors like unclear project scope of work, lack of experience and planning, an inability to conform a project to programming style rules, and a number of other seemingly small errors that build up and cause your code to be less ...

How do you deal with spaghetti codes?

In conclusion, spaghetti code is inevitable in any software engineering team. You can try to prevent the descent into spaghetti code by dealing with code debt as you go, refactoring and cleaning up at the end of a sprint, or during downtime.


1 Answers

To me, a more modern example of spaghetti code is when you have 20 dlls and every DLL references each other in one way or another. Your dependency graph looks like a huge blob, and your code hops all over the place with no real order. Everything is inter-dependent.

like image 59
Brian Genisio Avatar answered Oct 12 '22 13:10

Brian Genisio