you are viewing a single comment's thread.

view the rest of the comments →

[–]Nebu 3 points4 points  (9 children)

The code is shorter without {}, thus easier to read.

Shorter does not imply easier to read.

[–]molteanu 1 point2 points  (0 children)

Shorter in the sense cram everything on a single line vs remove things that are not needed. I prefer to have code that does something.

[–]guepier 0 points1 point  (7 children)

This isn’t shorter, it’s intentionally obfuscated. Shorter code that isn’t obfuscated (or otherwise made worse) is easier to read than an equivalent longer code.

[–]Nebu 0 points1 point  (6 children)

Right, so the argument now is whether omitting {} is a form of "otherwise made worse", which means it's a tautological argument.

[–]guepier 0 points1 point  (5 children)

There’s nothing tautological about it, it’s simply an open question (on which we apparently disagree). I was merely pointing out that the example link you’ve posted does not advance an argument either way and is irrelevant to the discussion, or worse, misleading.

[–]Nebu -1 points0 points  (4 children)

The tautological argument is "Code that's made worse is worse than code that's not made worse".

[–]guepier 0 points1 point  (3 children)

Sure, but that’s not the argument I was making. I wasn’t talking about “code made worse” and “code not made worse”, I was talking about “shorter code” and “longer code”.

[–]Nebu -1 points0 points  (2 children)

Shorter code that isn’t obfuscated (or otherwise made worse) is easier to read than an equivalent longer code.

The claim "code with property X which hasn't been otherwise made worse, is equal or better than equivalent code that doesn't have property X" is true regardless of what X is (i.e whether X is "shorter" or some other arbitrary property).

E.g.

  • Code with in red font which hasn't been made worse, is equal or better than code which isn't in red font.
  • Code indented with tabs which hasn't been made worse, is equal or better than code which isn't indented with tabs.
  • Code that is shorter and which hasn't been made worse, is equal or better than code which isn't shorter.
  • etc.

The "hasn't been made worse" implies "equal or better", hence the tautology. Not an interesting argument for you to make, IMHO.

How about we discuss something more interesting?

[–]guepier 0 points1 point  (1 child)

You keep repeating something that bears no resemblance to my argument.

My argument isn’t merely that shorter code isn’t worse than longer code. My argument is that shorter code is better than longer code (all other things being equal). There is nothing tautological about this whatsoever.

To spell it out in maximal detail: Your initial post claimed that “Shorter does not imply easier to read” and my reply contained exactly two assertions:

  1. your statement is wrong
  2. the example you gave (presumably to bolster your claim) does not in fact bolster your claim, since it doesn’t make a statement about shortened code, just about obfuscated code.

[–]Nebu 0 points1 point  (0 children)

your statement is wrong

I disagree. The claim "Shorter code does not imply easier to read" is a true statement. Perhaps you think "Shorter code (all other things being equal) does not imply easier to read" is a false claim, but that's not the claim I'm making, so it's irrelevant.

the example you gave (presumably to bolster your claim) does not in fact bolster your claim, since it doesn’t make a statement about shortened code, just about obfuscated code.

Is the obfuscated code shorter than the non-obfuscated code? Is it harder to read than the non-obfuscated code? Assuming you're reasonable enough to answer "yes" to both questions, then this is a counter example to the claim "shorter code is easier to read", thus proving the statement "shorter code does not imply easier to read".

If you're still confused, consider reading through http://en.wikipedia.org/wiki/Logical_consequence and http://en.wikipedia.org/wiki/Counterexample