Re:What to Do When Your Colleague Creates Spaghetti Code
by taneq on Friday September 16, 2016 @11:35AM
(#12514715)
> On the plus side, that means we don't have to sweat it so badly with the "right" way to write code and just accept that code eventually becomes one big mess with a gigantic, horrible 50-case switch statement in the middle.
No! No no. No it doesn't. Not unless someone makes it that way. Code doesn't have to become awful. It becomes awful when successive generations of maintainers choose quick easy partial-fixes over a bit of refactoring to fix the problem properly.
Code wants to be short, simple, clear, and easy to understand. People make it horrible by not caring (or by not seeing patterns).
I write code that way (hundreds of tiny methods/functions) because I find it easier to read and modify, and therefore maintain and I've largely done this from a junior dev's point of view where maintainance was most of the job I was doing day in, day out. If you find it hard to follow that sort of program flow maybe it's a sign that there's no rule and different people find different types of coding easier to maintain.
In which case we're all a bit screwed as we inevitably eventually will have to handle the code of someone who's had the opposite view than ours.
On the plus side, that means we don't have to sweat it so badly with the "right" way to write code and just accept that code eventually becomes one big mess with a gigantic, horrible 50-case switch statement in the middle.