top | item 22338057

(no title)

aercolino | 6 years ago

Yes, spaghetti-code is much better! /s

> Following the logic

That's what names are for. I prefer to find _afterLeft_ spread all over the place rather than `x2<=x1` even if it actually increases code size by 50%. I can validate it only once, and if I stumble upon _aboveBottom_ I don't even need to validate it to infer what it means (left as an exercise for the reader).

This spaghetti line: `x2<=x1&&x1+w1<=x2+w2&&y2<=y1&&y1+h1<=y2+h2`, in my opinion, is much harder than `inside`.

discuss

order

blub|6 years ago

x2 <= x1 is actually a one liner which could arguably be transformed into a one line function. OP was talking about splitting an entire program into 1-3 line functions, or at least that's how their sentence reads to me.