The Free Talk Live BBS

Free Talk Live => The Polling Pit => Topic started by: MobileDigit on April 11, 2007, 08:17:36 PM

Title: func( arg1, arg2 )
Post 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?
Title: Re: func( arg1, arg2 )
Post by: theghostofbj on April 11, 2007, 08:19:25 PM
Jesus...
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 11, 2007, 08:19:52 PM
I'm serious.
Title: Re: func( arg1, arg2 )
Post by: voodoo on April 11, 2007, 08:35:31 PM
readability
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 11, 2007, 08:39:36 PM
I disagree. By introducing extra spaces, it makes it more difficult to read, because the important parts are not cleanly separated.
Title: Re: func( arg1, arg2 )
Post by: voodoo on April 11, 2007, 08:40:36 PM
To my eyes there is.
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 11, 2007, 09:01:50 PM
To my eyes there is.

I don't understand.
Title: Re: func( arg1, arg2 )
Post by: sillyperson on April 11, 2007, 10:04:56 PM
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.
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 11, 2007, 11:09:12 PM
Are you arguing for or against the extra spaces?
Title: Re: func( arg1, arg2 )
Post by: felix.benner on April 12, 2007, 03:13:33 AM
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.
Title: Re: func( arg1, arg2 )
Post by: wtfk on April 12, 2007, 04:48:15 AM
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.
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 12, 2007, 12:50:06 PM
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
Title: Re: func( arg1, arg2 )
Post by: sillyperson on April 12, 2007, 01:05:23 PM
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
Title: Re: func( arg1, arg2 )
Post by: gibson042 on April 12, 2007, 01:38:43 PM
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.
Title: Re: func( arg1, arg2 )
Post by: rabidfurby on April 12, 2007, 03:05:15 PM
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:

Code: [Select]
if (foo % 42 == pow(bar, 2) &&
\tfoo != baz)
{
\tprintf("whee!");
}

With tabstops set to four spaces, you get the following:

Code: [Select]
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:

Code: [Select]
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.
Title: Re: func( arg1, arg2 )
Post by: gibson042 on April 12, 2007, 04:26:36 PM
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:

Code: [Select]
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:
Code: [Select]
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.
Title: Re: func( arg1, arg2 )
Post by: wtfk on April 12, 2007, 04:30:12 PM
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.
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 12, 2007, 04:58:46 PM
#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.
Title: Re: func( arg1, arg2 )
Post by: wtfk on April 12, 2007, 05:07:18 PM
#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    ***
***                                                   ***
*********************************************************/
Title: Re: func( arg1, arg2 )
Post by: gibson042 on April 12, 2007, 05:11:25 PM
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.
Title: Re: func( arg1, arg2 )
Post by: wtfk on April 12, 2007, 05:15:15 PM
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.
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 12, 2007, 05:19:15 PM
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
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 12, 2007, 05:22:19 PM
Sometimes special punctuation helps

func( arg1, arg2 ) is not special, it is common.
Title: Re: func( arg1, arg2 )
Post by: wtfk on April 12, 2007, 05:25:42 PM
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 . "
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 12, 2007, 05:37:29 PM
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
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 12, 2007, 06:47:27 PM
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.
Title: Re: func( arg1, arg2 )
Post by: rabidfurby on April 12, 2007, 06:54:55 PM
#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)".
Title: Re: func( arg1, arg2 )
Post by: theCelestrian on April 12, 2007, 09:45:45 PM
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.
Title: Re: func( arg1, arg2 )
Post by: Lindsey on April 12, 2007, 10:10:44 PM
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
Title: Re: func( arg1, arg2 )
Post by: wtfk on April 12, 2007, 10:23:55 PM
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.
Title: Re: func( arg1, arg2 )
Post by: Lindsey on April 12, 2007, 10:42:01 PM
I think the answer is still "Who cares?  Whatever you want."   :shock:
Title: Re: func( arg1, arg2 )
Post by: sillyperson on April 13, 2007, 10:51:49 AM
I hate it when some IDEs bury the fracking tab features
I just hate IDEs
Title: Re: func( arg1, arg2 )
Post by: sillyperson on April 13, 2007, 10:53:46 AM
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.
Title: Re: func( arg1, arg2 )
Post by: theCelestrian on April 13, 2007, 12:01:44 PM
Quote
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.)
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 13, 2007, 12:18:42 PM
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
Title: Re: func( arg1, arg2 )
Post by: sillyperson on April 13, 2007, 12:58:02 PM
Quote
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!
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 13, 2007, 01:00:54 PM
Quote
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)
Title: Re: func( arg1, arg2 )
Post by: lordmetroid on April 13, 2007, 01:20:47 PM
Never... I could never accept the extra spaces!
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 13, 2007, 01:21:45 PM
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
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 13, 2007, 01:30:47 PM
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?
Title: Re: func( arg1, arg2 )
Post by: theCelestrian on April 13, 2007, 01:44:59 PM
Quote
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.)
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 13, 2007, 01:48:09 PM
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.
Quote
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
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 13, 2007, 01:51:11 PM
It does not...
address the issue of extra spaces after open parens and before closing parens.
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 13, 2007, 01:53:46 PM
It does not...
address the issue of extra spaces after open parens and before closing parens.

It's implied.

-- Brede
Title: Re: func( arg1, arg2 )
Post by: MobileDigit on April 13, 2007, 02:00:30 PM
How?
Title: Re: func( arg1, arg2 )
Post by: lordmetroid on April 13, 2007, 04:28:02 PM
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:
Title: Re: func( arg1, arg2 )
Post by: ladyattis on April 13, 2007, 04:30:26 PM
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