EMZETT.
Login

Spaghetti Code

In short: Spaghetti code is confusing, tangled source code whose flow is hard to follow.

In more detail: The name comes from the image of the control flow knotting up like spaghetti.

In Depth

Causes

Many jumps (goto), deeply nested conditions, huge methods, global variables, missing structure and copied code.

Remedies

Functions and classes with a clear task (SRP), meaningful names, refactoring (refactoring), tests, code reviews. See SOLID principles.

See also: SRP, Refactoring, SOLID-Prinzipien