News for hackers. Stuff that matters.
Re:What to Do When Your Colleague Creates Spaghetti Code by jszymborski on Friday September 16, 2016 @09:50AM (#12513938)
Interesting... Not knowing this background, I always assumed spaghetti code referred to the opposite in modern code: too many nested blocks.

I'm always super afraid of growing mounds of logic, and my refactoring usually abstracts a lot of that logic out.

If you use a good IDE like IDEA/Jetbrains, you can ease the pain of those "one-line functions" with "click to navigate" function/variable names

Re:What to Do When Your Colleague Creates Spaghetti Code by yoz-y on Friday September 16, 2016 @09:58AM (#12513999)
For me spaghetti code is called so because when you start pulling on one string of the code you end up spilling everything. A 5-layered for/if statement does not have this property but using abstractions everywhere does.
Re:What to Do When Your Colleague Creates Spaghetti Code by smonff on Friday September 16, 2016 @10:07AM (#12514078)
> For me spaghetti code is called so because when you start pulling on one string of the code you end up spilling everything. A 5-layered for/if statement does not have this property but using abstractions everywhere does.

So in theory a well unit-tested spaghetti-code would make you more relaxed because it would assert that spaghetti A interacts with spaghetti B in the C way.

Re:What to Do When Your Colleague Creates Spaghetti Code by yoz-y on Friday September 16, 2016 @10:19AM (#12514158)
> So in theory a well unit-tested spaghetti-code would make you more relaxed because it would assert that spaghetti A interacts with spaghetti B in the C way.

I don't follow. In my experience well-unit-tested and spaghetti code are mutually exclusive as the spaghetti code does not have separation of concerns.

A note on my opinion on abstractions to clarify: I do not think that abstraction is inherently bad, just that starting with the idea that every component has to be generic, each class must have an abstract interface and that code should never ever see into another classes implementation tends to force developers to make so much mental yoga that they end up tying the components together without realising it.