|
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.
|
|
|
|
|
How would you feel about
condition ? DoThis() : DoThat(); ?
My plan is to live forever ... so far so good
|
|
|
|
|
condition
? DoThis()
: DoThat();
And now?
All in all none of this really matters. As long as everyone on the project sticks to a predetermined coding standard, then the format doesn't matter as much, as long as its consistent.
Consistency in code can resolve a huge amount of misunderstanding.
|
|
|
|
|
Standard? STANDARD? What's that???
I found that we do keep to standards whenever all the other developers code exactly the same way as I do.
My plan is to live forever ... so far so good
|
|
|
|
|
The reason I moved from VB.NET to C# was the curly braces bro! Don't make me give up the curly braces!
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
I don't care very much as long as it's consistent.
But since you can't make multiple statements without braces...
Wrong is evil and must be defeated. - Jeff Ello
(√-sh*t) 2
|
|
|
|
|
Either one of those suits me fine. The ones I can't stand are these:
if (condition)
{
DoThis();
}
else
DoThat();
if (condition)
DoThis();
else
{
DoThat();
}
Anything that is unrelated to elephants is irrelephant Anonymous ----- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944 ----- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
And then there is the choice between:
if (condition) vs if (condition == true)
if (!condition) vs if (condition == false)
I sometimes put in the == false part because the ! is easy to miss when reading.
|
|
|
|
|
Karel Čapek wrote: Why are people so lazy?
Did it occur to you that it may be about style and not laziness?
Some people can have even another style:
if (condition) DoThis();
else DoThat();
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Fabio Franco wrote: Did it occur to you that it may be about style and not laziness?
No: people who do this tend to shortcut other things (sweeping generalization and/or observation over many years of being a coder) or crush the code into as small a space as possible making it hard to read.
The point is really to have consistency of style and format in the code: braces make it easier to read. Consider this:
int a = 0;
string bean = "green";
float golden= 1.618;
if (condition)
{
x = 42;
bean = "eatme";
golden = a * pi;
}
else
a = 1;
bean = 'foo';
golden = a - x;
I find that style difficult to read and adding the braces would make it much easier to see the flow.
Oh, and then there are tabs v spaces...
|
|
|
|
|
I only remove braces on single-line method preconditions at the beginning of a method:
if (arg==null) throw new ArgumentNullException("arg", arg);
Everywhere else I put braces.
|
|
|
|
|
Vark111 wrote: if (arg==null) throw new ArgumentNullException("arg", arg);
Let me guess - You're used to dealing with Pirated software???
Anything that is unrelated to elephants is irrelephant Anonymous ----- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944 ----- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
I personally prefer the former of the two, for readability. I tend to "speed read" classes and utilize the curly brackets as logical breaks in the code.
Basically, for me, it differentiates between code indentations and logic (if, foreach, for, etc.)
ICP-Fan
(The Keyboard Wielding Maniac)
|
|
|
|
|
Karel Čapek wrote: For example, how hard is it to
Both are probably less hard than complaining about it.
But other than that since it is legitimate syntax then it is legitimate syntax and nothing but a preference after that.
Naturally if that is the most important problem facing you day to day or even one that even rises above the noise level in terms of problems you must work at an exceeding stellar place.
I once worked a a place where the VP (most senior person in the entire site) would regularly take down the database through incorrect usage which would shut down the call center (several hundred employees) completely. Now that is a problem.
|
|
|
|
|
I have more
(condition)?DoThis():DoThat();
DoThese[(condition)]();
#define CALL_FUNC(__F) Do##__F
CALL_FUNC(condition);
do
{
if(condition)
{
DoThis();
break;
}
} while(DoThat()&&condition);
<pre lang="cs">
switch(condition)
{
case 1:
DoThis();
break;
default:
DoThat();
}
|
|
|
|
|
On a news site I heard a recording of a man as he was beaten to death.
It would have been offensive but they took care to *bleep* out the swearing.
The insanity of that is difficult to process.
|
|
|
|
|
What??? Why??? What???
People are every disturbing.
|
|
|
|
|
Remember what the MPAA says; Horrific, Deplorable violence is okay, as long as people don't say any naughty words!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Who are we and what have we become? We have made progress with technology, but we seem to still be in the dark ages when it comes to civility and morality.
|
|
|
|
|
My gripe is that NOBODY would want a recording of a relative/friend/co-worker being beaten to death out on a news site. We don't need to hear that and it is cruel to those that loved the victim. It is hoggish.
|
|
|
|
|
I remember the first beheading I saw on national TV (and in South Africa it is still quite conservative) of a man called Nic Good (I think). It happened in the Middle East many years ago and was quite a stir all over the world. I was so shocked and sickened that I wanted to go there and kill everyone remotely affiliated with the religion involved. I did calm down by the end of the week, but what has been seen can never be unseen.
I know it still happens a lot to this day, but I was also hoping that we would have evolved past this barbarism by now.
My plan is to live forever ... so far so good
|
|
|
|
|
Absolutely, positively agree. It's disgusting that the media broadcasts things like that just to make a buck, never mind how it affects people.
I feel the same way about 911 calls. Do we really have to broadcast some poor person's worst, most tragic moment just to bump ratings? It's exploitation of victims for money, ought to be a crime.
|
|
|
|
|
|
Dan Neely wrote: spend a few hours over xmas break playing around with some of the new features in VS2015 You're doing it wrong.
Jeremy Falcon
|
|
|
|