The Free Talk Live BBS
Free Talk Live => The Polling Pit => Topic started by: MobileDigit on April 11, 2007, 08:17:36 PM
-
I find putting spaces before/after arguments to be mildly annoying, so if you are someone that codes that way, why do you do it?
-
Jesus...
-
I'm serious.
-
readability
-
I disagree. By introducing extra spaces, it makes it more difficult to read, because the important parts are not cleanly separated.
-
To my eyes there is.
-
To my eyes there is.
I don't understand.
-
I hate bastards that code in a way that hurts my eyes.
#1 USE FUCKING WHITESPACE
If it bothers you that much, write an editor macro that strips them before opening, and reintroduces upon close.
#2 USE FUCKING VOWELS
Some people act like they cost extra. I'll take "newFile" over "nwfl" any day.
#3 USE TABS AND DIE
\t is not on your term what it might be on my term. You want whitespace, you use ASCII 0x20, period
Thanks.
-
Are you arguing for or against the extra spaces?
-
I hate bastards that code in a way that hurts my eyes.
#1 USE FUCKING WHITESPACE
If it bothers you that much, write an editor macro that strips them before opening, and reintroduces upon close.
#3 USE TABS AND DIE
\t is not on your term what it might be on my term. You want whitespace, you use ASCII 0x20, period
If it bothers you that much, write an editor macro that changes tabs at the beginning into 4 spaces and reintroduces upon close.
Whitespace is to separate tokens, tab is to indent.
-
I hate bastards that code in a way that hurts my eyes.
#1 USE FUCKING WHITESPACE
If it bothers you that much, write an editor macro that strips them before opening, and reintroduces upon close.
#3 USE TABS AND DIE
\t is not on your term what it might be on my term. You want whitespace, you use ASCII 0x20, period
If it bothers you that much, write an editor macro that changes tabs at the beginning into 4 spaces and reintroduces upon close.
Whitespace is to separate tokens, tab is to indent.
Tab is to confuse. Joe uses 2 character tabs, Sam uses 4. Sally uses 8 character tabs, Simon 3. I use four spaces, and Joe, Sam, Sally and Simon can read my code.
-
I use the extra spaces for visual legibility since my eyes are fracked up anymore. But I would say I prefer the lack of the spaces in most cases only because I don't want to have to reset my tabs based on the extra white space (ex. foo ( one , two ) <-- okay, but I find it annoying as the final product, foo(one, two) <-- better since the extra space is only between the arguments and not between the brackets or the function/method name. ).
-- Brede
-
Are you arguing for or against the extra spaces?
#1 USE FUCKING WHITESPACE
How do I make it clearer, so you can read it?
Like this?
#1USEFUCKINGWHITESPACE
-
Tab is to confuse. Joe uses 2 character tabs, Sam uses 4. Sally uses 8 character tabs, Simon 3. I use four spaces, and Joe, Sam, Sally and Simon can read my code.
If you indent with tabs, then everyone can read your code in the presentation most comfortable for them.
-
Tab is to confuse. Joe uses 2 character tabs, Sam uses 4. Sally uses 8 character tabs, Simon 3. I use four spaces, and Joe, Sam, Sally and Simon can read my code.
If you indent with tabs, then everyone can read your code in the presentation most comfortable for them.
Not necessarily. Consider this code, where \t represents a tab:
if (foo % 42 == pow(bar, 2) &&
\tfoo != baz)
{
\tprintf("whee!");
}
With tabstops set to four spaces, you get the following:
if (foo % 42 == pow(bar, 2) &&
foo != baz)
{
printf("whee!");
}
The two lines of the conditional line up, which is probably what the author intended to improve readability. With 8-space tabstops, you get this:
if (foo % 42 == pow(bar, 2) &&
foo != baz)
{
printf("whee!");
}
The conditional no longer lines up, breaking the author's intended readability. This is a contrived example, obviously, but the point is that using \t can and will break readability.
-
If you indent with tabs, then everyone can read your code in the presentation most comfortable for them.
Not necessarily. Consider this code, where \t represents a tab:
if (foo % 42 == pow(bar, 2) &&
\tfoo != baz)
{
\tprintf("whee!");
}
I would consider that code equally readable regardless of tab width. Regardless, if alignment was so critical then it could have been written like so:
if (
\tfoo % 42 == pow(bar, 2) &&
\tfoo != baz)
{
\tprintf("whee!");
}
And don't talk to me about wasting lines; if that was important the code would have used 1TBS (http://en.wikipedia.org/wiki/Indent_style#K.26R_style) in the first place. Another fix—although not one with my support—would use spaces for the continuing conditional and tabs for block indentation in something akin to KNF style.
-
Tab is to confuse. Joe uses 2 character tabs, Sam uses 4. Sally uses 8 character tabs, Simon 3. I use four spaces, and Joe, Sam, Sally and Simon can read my code.
If you indent with tabs, then everyone can read your code in the presentation most comfortable for them.
Spoken like someone who has never opened and tried to read someone else's code with different tab stop settings than his own. Really, after 25 years, I do know what the fuck I'm talking about.
-
#1USEFUCKINGWHITESPACE
Which is easier to read:
#1 USE FUCKING WHITESPACE
or,
# 1 U S E F U C K I N G W H I T E S P A C E
?
If you introduce extra spaces it makes it more difficult to scan.
-
#1USEFUCKINGWHITESPACE
Which is easier to read:
#1 USE FUCKING WHITESPACE
or,
# 1 U S E F U C K I N G W H I T E S P A C E
?
If you introduce extra spaces it makes it more difficult to scan.
Sometimes special punctuation helps:
/********************************************************
*** ***
*** U S E F U C K I N G W H I T E S P A C E ***
*** ***
*********************************************************/
-
If you indent with tabs, then everyone can read your code in the presentation most comfortable for them.
Spoken like someone who has never opened and tried to read someone else's code with different tab stop settings than his own. Really, after 25 years, I do know what the fuck I'm talking about.
If code is unreadable at your tab width (a problem I have never encountered after 15 years), you can change it to equal the author's and see the code exactly as it was written (the so-called benefit of spaces). But tabs, unlike spaces, do not require that kind of viewing.
-
If you indent with tabs, then everyone can read your code in the presentation most comfortable for them.
Spoken like someone who has never opened and tried to read someone else's code with different tab stop settings than his own. Really, after 25 years, I do know what the fuck I'm talking about.
If code is unreadable at your tab width (a problem I have never encountered after 15 years), you can change it to equal the author's and see the code exactly as it was written (the so-called benefit of spaces). But tabs, unlike spaces, do not require that kind of viewing.
What "kind" of viewing are you taking about? I'm sort of addicted to being able to read the code I'm editing, and I don't particularly like spending 5 minutes interactively changing the tab widths then inspecting the code to see if it looks indented properly for each effing source file I open. That's why virtually everyone I've worked with has gone from tabs to tabs-as-spaces.
-
On a side note, I hate it when some IDEs bury the fracking tab features so deep in the options selection that I just give up. Like with Netbeans or BlueJ, fracking hell!
-- Brede
-
Sometimes special punctuation helps
func( arg1, arg2 ) is not special, it is common.
-
Sometimes special punctuation helps
func( arg1, arg2 ) is not special, it is common.
I was referring the comments such as " U S E F U C K I N G W H I T E S P A C E . "
-
http://en.wikipedia.org/wiki/Indent_style
http://en.wikipedia.org/wiki/Programming_style
Definitely too late for the party, but what the fuck, maybe the stragglers will be able to use these articles from the Mighty Mighty Wiki.
-- Brede
-
http://en.wikipedia.org/wiki/Indent_style
http://en.wikipedia.org/wiki/Programming_style
Neither of these address the issue of extra spaces after open parens and before closing parens.
-
#1USEFUCKINGWHITESPACE
Which is easier to read:
#1 USE FUCKING WHITESPACE
or,
# 1 U S E F U C K I N G W H I T E S P A C E
?
If you introduce extra spaces it makes it more difficult to scan.
Which is better:
USE FUCKING WHITESPACE
or
USEFUCKINGWHITESPACE
?
Brains work as tokenizers; they break things into chunks based on whitespace. Whitespace should be used to separate things which are logically separate, such as words in prose and arguments to a function call in code. "USE" and "FUCKING" are logically separate, so they should be separately presented. The letters in "USE" and "FUCKING" are part of the same entity, so they should be grouped. Similarly, func(arg1, arg2) makes more sense than func(arg1,arg2) because arg1 and arg2 are two logically separate entities.
However, I think func( arg1, arg2 ) is unnecessary, because the parens themselves act as a delimiter. Same goes for the GNU coding style (http://www.gnu.org/prep/standards/standards.html#Formatting), which requires a space after the function name - such as "func (arg1, arg2)".
-
As a former employer who paid people to do this, I'll make this easy: If you're gonna code for money, and you're part of a development team, your code better follow whatever readability standards your company has set. Period, end of story.
If that means I want you to use white space, tab-indent your code 4 spaces, camelize your variable names, provide pre-conditions and post conditions for your functions and comment explicitly enough so that it actually describes what code is supposed to be doing as well as log any edits that you make to the code...
...then your ass better do it.
If you're coding for youself, who cares? I don't have to read your code, so do what you want.
-
As a former employer who paid people to do this, I'll make this easy: If you're gonna code for money, and you're part of a development team, your code better follow whatever readability standards your company has set. Period, end of story.
If that means I want you to use white space, tab-indent your code 4 spaces, camelize your variable names, provide pre-conditions and post conditions for your functions and comment explicitly enough so that it actually describes what code is supposed to be doing as well as log any edits that you make to the code...
...then your ass better do it.
If you're coding for youself, who cares? I don't have to read your code, so do what you want.
+1
-
As a former employer who paid people to do this, I'll make this easy: If you're gonna code for money, and you're part of a development team, your code better follow whatever readability standards your company has set. Period, end of story.
If that means I want you to use white space, tab-indent your code 4 spaces, camelize your variable names, provide pre-conditions and post conditions for your functions and comment explicitly enough so that it actually describes what code is supposed to be doing as well as log any edits that you make to the code...
...then your ass better do it.
If you're coding for youself, who cares? I don't have to read your code, so do what you want.
I believe that goes unsaid. The question had to do with what is preferable.
-
I think the answer is still "Who cares? Whatever you want." :shock:
-
I hate it when some IDEs bury the fracking tab features
I just hate IDEs
-
I want you to use white space, tab-indent your code 4 spaces, camelize your variable names, provide pre-conditions and post conditions for your functions and comment explicitly enough so that it actually describes what code is supposed to be doing as well as log any edits that you make to the code...
...then your ass better do it.
Hence the use of the past tense in relation to your job of managing the work of others.
Coders are artists; you can't manage them like blue-collar workers.
-
Hence the use of the past tense in relation to your job of managing the work of others.
Coders are artists; you can't manage them like blue-collar workers.
First off, I am a coder, and an artist by education and profession.
Second, you have no fucking clue as to why I decided to no longer keep employees for MY business. (hint: had a lot to do with payroll taxes and regulations, than with my ability to manage.)
(EDIT: you also have no idea if the case I gave was the one I used for my business.... which it wasn't, so you might want to consider it a hypothetical situation before you pass judgment, Mr. Coder as Artist)
...Might want to consider what you say before you open your god damn mouth.
(2nd Edit: and yes, I've had a bit to drink tonight, so I'm probably a bit more irritated at this post than I normally would be when sober.)
-
http://en.wikipedia.org/wiki/Indent_style
http://en.wikipedia.org/wiki/Programming_style
Neither of these address the issue of extra spaces after open parens and before closing parens.
It does as part of its format style, so read it again *smacks thee with a stack of Mad Magazines*
-- Brede
-
Hence the use of the past tense in relation to your job of managing the work of others.
you have no fucking clue
You just got trolled, dude.
Too easy!
-
Hence the use of the past tense in relation to your job of managing the work of others.
you have no fucking clue
You just got trolled, dude.
Too easy!
BORK BORK BORK!
(http://img59.imageshack.us/img59/8748/swedishchef2mm6.jpg)
-
Never... I could never accept the extra spaces!
-
Never... I could never accept the extra spaces!
I just say use them when your eyes are tired, but really one shouldn't code when one's tired, it makes for sloppy code or bad implementation.
-- Brede
-
http://en.wikipedia.org/wiki/Indent_style
http://en.wikipedia.org/wiki/Programming_style
Neither of these address the issue of extra spaces after open parens and before closing parens.
It does as part of its format style
Where?
-
You just got trolled, dude.
Too easy!
Hey, d.... little inebriated right now, so I wouldn't think too highly of this "victory" of yours (got back from one of them crazy Japanese drinking parties, an enkai, about an hour and a half ago). Try it on me again in about 9-10 hours. ;)
(edit: trying to fix some drunken typos... let's see if I can do it without fucking up.)
-
http://en.wikipedia.org/wiki/Indent_style
http://en.wikipedia.org/wiki/Programming_style
Neither of these address the issue of extra spaces after open parens and before closing parens.
It does as part of its format style
Where?
From the wiki article about Programming Style.
Spacing
Free-format languages often completely ignore whitespace. Making good use of spacing in code layout is therefore considered good programming style.
Compare the following examples of C code.
int count;
for(count=0;count<10;count++)
{
printf("%d",count*count+count);
}
with
int count;
for (count = 0; count < 10; count++)
{
printf("%d", count * count + count);
}
In the C-family languages, it is also recommended to avoid using tab characters in the middle of a line as different text editors render their width differently.
Please deposit apology beer in the teleporter before reply. :3
-- Brede
-
It does not...
address the issue of extra spaces after open parens and before closing parens.
-
It does not...
address the issue of extra spaces after open parens and before closing parens.
It's implied.
-- Brede
-
How?
-
Never... I could never accept the extra spaces!
I just say use them when your eyes are tired, but really one shouldn't code when one's tired, it makes for sloppy code or bad implementation.
Of course you should... That's when your invent new stuff. Might not work the day after when you test it out but still :lol:
-
How?
By the variation between having foo (one, two) and foo(one,two) in that white space is accorded differently within the round brackets. [ ]
-- Brede