|
Then I reakon I can get fries with that eh?
|
|
|
|
|
Youse just tryin' ta git ma t'say t'Magic Words, y-all!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
A BLC? Bacon, Lettuce and Code sandwich?
Why can't I be applicable like John? - Me, April 2011 ----- Beidh ceol, caint agus craic againn - Seán Bán Breathnach ----- Da mihi sis crustum Etruscum cum omnibus in eo! ----- Just because a thing is new don’t mean that it’s better - Will Rogers, September 4, 1932
|
|
|
|
|
Johnny J. wrote: Bacon, lettuce and Code sandwich
FTFY!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
5
Bacon replies are timely and awesome !
|
|
|
|
|
Thief[^]!
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|
|
Since when usage of unnecessary symbols has started improving readability? And aren't we suppose to consistently try to minimize amount of code we write?
|
|
|
|
|
Exactly. Curly braces are noise. Languages with good syntax don't even have them.
|
|
|
|
|
Agreed. Superior languages such as VB.NET don't have stupid braces.
|
|
|
|
|
I really had in mind ML and Python
|
|
|
|
|
Languages like VB.NET - where they realize the user cannot comprehend the beginning and end of a statement lest it be spelled out for them.
You don't have to remain left-out, you know! Just start to program in a language the doesn't presume your IQ consist of one or two digits.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Readability is one reason. There is another one in my opinion, extensibility. We never know whether we'll need to insert a second statement, considering that programming (and thinking) is an iterative and adaptive process.
Best,
Jun
|
|
|
|
|
Jun Du wrote: extensibility
Hahha Yeah, the fact that we're writing our code in stone stops us from adding a pair of braces around new block of code.
And if someone has trouble remembering to add braces after inserting new lines should consider changing career.
|
|
|
|
|
It's not that someone has trouble adding braces concerns me. That is taken care of by the compiler. Some developers tend to closes up their code (and mind) at the first iteration of implementation. As a side note, in reality, I didn't find many cases where one statement is enough.
Best,
Jun
|
|
|
|
|
Jun Du wrote: Some developers tend to closes up their code (and mind) at the first iteration
of implementation.
What a crock of horsesh*t.
Jun Du wrote: As a side note, in reality, I didn't find many cases where one statement is
enough.
Apparently we're not living in the same realities then.
|
|
|
|
|
Mladen Jankovic wrote: And aren't we suppose to consistently try to minimize amount of code we write?
no.
|
|
|
|
|
Good thing we're not working togather.
|
|
|
|
|
Mladen Jankovic wrote: aren't we suppose to consistently try to minimize amount of code we write?
Yes, but only if other things are equal, i.e., we don't decrease readability, maintainability and reliability.
Now, as it happens I don't consider the omission of parentheses is that big a deal. But if others feel it decreases readability and maintainability then that would trump "less code is better."
Kevin
|
|
|
|
|
I always wrap single line statements.
I also always put them on a seperate line to make it easier to read.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
For me, it's not a readability thing - though that helps. I find it difficult to read this correctly:
if (aVariable > anotherVariable) yetAnotherVariable = 6;
aTotallyDifferentVariable = 7;
But the main reason I do it is because I have been bitten by problems caused by editors that don't auto-indent before:
if (aVariable > anotherVariable)
yetAnotherVariable = 6;
aTotallyDifferentVariable = 7;
Is not the same as
if (aVariable > anotherVariable)
{
yetAnotherVariable = 6;
}
aTotallyDifferentVariable = 7;
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Heck, why don't you use few more pairs of braces, make a point and let it be more obvious:
if (aVariable > anotherVariable)
{{{{{
{{{{{
{{{{{
yetAnotherVariable = 6;
}}}}}
}}}}}
}}}}}
aTotallyDifferentVariable = 7;
|
|
|
|
|
Let's not get carried away - 5 + 5 should be enough!
Have you seen what VS does with your code when you cut'n'paste?
void x()
{
if (aVariable > anotherVariable)
{
{
{
{
{
{
{
{
{
{
{
{
{
{
{
yetAnotherVariable = 6;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
aTotallyDifferentVariable = 7;
}
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
cfff! cfff! cfff! cfff! pffr! pffr! cfff! BOOOM!
|
|
|
|
|
Yes, that is a good point. To me readability includes easily being able to tell what the code is going to do
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|