Tuesday, September 25, 2007

Cuddle-schmuddle

See this sorry excuse for an argument.
I'm not falling for the "subordinate" argument- if we follow that line of thinking to its conclusion, we'd avoid using whitespace altogether. The statements below the if statement are clearly subordinate to the if clause because it is indented. I haven't ever heard of a misunderstanding induced by this "unclear" subordination principle. I have seen many coding errors induced because the maintainer either cuddled their braces or expected the previous coder to have cuddled them. Cuddling is madness.

4 comments:

Bossk said...

You say the "subordinate" argument would lead to elimination of whitespace if taken to its conclusion. That couldn't be further than the truth. It is precisely the whitespace in a cuddled layout that indicates the logical structure of a program and thus are quite indispensable. In fact, the opposite to your claim seems to be the case, where coders who do not cuddle play fast and loose with indentation (presumably assuming that their bracketing "style" will somehow make it all clear in the end).

RibRdb said...

The real problem isn't cuddling, the problem is that we're using text to represent code. If we could store structured data, everyone could cuddle or uncuddle as they see fit.

Unfortunately there's no way to do that at the moment, so the best solution is a consistent style. People working on the same code base should put their pride aside and use the same style. Both have their drawbacks and advantages. People who don't cuddle have a tendency to leave of optional braces for example, which can lead to problems later. Personally I like cuddling because it saves vertical space. And seriously, what's the point in being puritanical about this? Everyone should embrace cuddling!

schwerwolf said...

"People who don't cuddle have a tendency to leave off optional braces for example."
Funny, that's what I thought of the cuddlers.

"And seriously, what's the point in being puritanical about this?"
Who's being puritanical, Mr.Everyone-Should-Embrace-Cuddling?

Actually, I was just looking for an excuse to start a new blog.

schwerwolf said...

See the "Make like look alike" section.
on this page.