|
It's interesting that the older the programmer the more concision becomes important.
Ron Christie
|
|
|
|
|
If their functions are really long they can see more of it on one screen that way.
|
|
|
|
|
|
Cool, Religious war in the Lounge!!!
I'd rather be phishing!
|
|
|
|
|
What exactly is a peeve? and how do you train it?
I prefer the second method as a matter of style and space. To each his/her own!
New version: WinHeist Version 2.1.0
There's a fine line between crazy and free spirited and it's usually a prescription.
I'm currently unsupervised, I know it freaks me out too but the possibilities are endless.
|
|
|
|
|
In a coding standard that put's { 's on their own line I prefer this:
if (condition)
DoThis();
else DoThat();
If you're putting the { on the previous line, IMO they're easy enough to overlook that the explicit closing } is needed.
And if you're writing javascript the opening { is obligate and this:
if (condition) { DoThis();
} else {DoThat();}
or this:
if (condition) DoThis() else DoThat();
are obscenities.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
It's not laziness. The second one is quicker and easier to read IF the condition and the branched commands are short.
As soon as any of those lines gets the slightest bit complicated, or if there's any nesting at all, I add the braces.
|
|
|
|
|
Ian Shlasko wrote: As soon as any of those lines gets the slightest bit complicated, or if there's any nesting at all, I add the braces.
Jeremy Falcon
|
|
|
|
|
IMHO the latter is easier to read. I've recently had to resort to cheap reading glasses as { started looking like (! (even at 125%}
I don't always use {}, but when I do, I also prefer then on their own lines for readability.
"Go forth into the source" - Neal Morse
|
|
|
|
|
kmoorevs wrote: I don't always use {}, but when I do, I also prefer then on their own lines for readability. Click Me[^]
Jeremy Falcon
|
|
|
|
|
High five!
"Go forth into the source" - Neal Morse
|
|
|
|
|
The decision which to use is simple:
- follow the coding standard
- if you don't have it, use whichever style is used in file/project
- new project/file, use whatever you find more atheistically pleasing to you
Personal atheistic preference is one of very few arguments that I can accept as valid in this "debate" (like in any other debate on any kind of style).
The only argument that is supported by concrete numbers is saved on-screen space by the second style. All other arguments are largely unsubstantiated (maybe I'm wrong, but let me see some numbers)
So don't go around calling people lazy just because they don't conform to your preference, it can make you look obnoxious.
<edit>
My preference: ?: . What' you gonna do now?
<edit>
|
|
|
|
|
Mladen Janković wrote: So don't go around calling people lazy just because they don't conform to your preference, it can make you look obnoxious.
++Mladen.rep;
|
|
|
|
|
Mladen Janković wrote: it can make you look obnoxious.
But I am obnoxious
|
|
|
|
|
Well I can't argue with that
|
|
|
|
|
Do you really require 8 lines to convey 4 lines worth of information?
Perhaps "begin" and "end" would be even more clear? How about "then"?
if (condition) then
begin
DoThis();
end
else
begin
DoThat();
end;
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
oh dear lord
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
LOL, that looks exactly like T-SQL
|
|
|
|
|
I am not lazy (well, I may be, but that's not the point) and the reason I prefer the latter is to reduce the noise. Less noise, more readability.
|
|
|
|
|
Personally, for one line this-or-that...
condition.IfTrue(()=>DoThis()).Else(()=>DoThat());
Marc
|
|
|
|
|
Yes, I am sure for your disciples that's a very good thing
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
If both branches are a single line, I prefer the second. However, I've seen too much of this abomination:
if (condition)
{
DoThis();
DoSomethingElse();
}
else
DoThat();
|
|
|
|
|
If there's only one "do", the whole thing should be on one line.
The reason the blocks were introduced is because multiple "do"s on one line are hard to read, so insisting that a single "do" be in a block is taking the idea in the wrong direction.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Perhaps best to blame the language designers for allowing such freedom ?
I'm with Chris L. and others who point out we're no longer in the age of fewer-characters-are-best-because-memory's-so-precious that we can't afford white-space, or beaucoup de braces.
C# code that looks like VB has the smell of sewage to me (note: I do not "hate" VB).
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
They think, If we write that way then our system will be heavy as each character has some byte.
|
|
|
|