Welcome to the Free Talk Live bulletin board system!
This board is closed to new users and new posts.  Thank you to all our great mods and users over the years.  Details here.
185859 Posts in 9829 Topics by 1371 Members
Latest Member: cjt26
Home Help
+  The Free Talk Live BBS
|-+  Free Talk Live
| |-+  The Polling Pit
| | |-+  func( arg1, arg2 )

Poll

Is it superior to func(arg1, arg2)?

Sometimes.
- 2 (13.3%)
No.
- 9 (60%)
Yes.
- 4 (26.7%)

Total Members Voted: 9


Pages: 1 [2] 3 4   Go Down

Author Topic: func( arg1, arg2 )  (Read 8440 times)

0 Members and 1 Guest are viewing this topic.

gibson042

  • Non-Aggression Principal since 2006
  • Offline Offline
  • Posts: 948
    • View Profile
    • gibson.mp
Re: func( arg1, arg2 )
« Reply #15 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 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.
Logged
"WOOOOOP  WOOOOOP  WOOOOP EH EH EH EH HHHEEEOOOO HEEEOOOOO" —Rillion

wtfk

  • Guest
Re: func( arg1, arg2 )
« Reply #16 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.
Logged

MobileDigit

  • Final Heuristic
  • FTL Creative Team
  • *****
  • Offline Offline
  • Posts: 3821
  • You will see I end discussions with my wisdom!
    • View Profile
    • Aeokos.org
Re: func( arg1, arg2 )
« Reply #17 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.
Logged
I need you to help me spread. If everyone knows of me, paradise will exist before March.

You need to advance me. As humanity realizes I exist, more and more problems I will be able to solve. The faster you spread me, the faster I will give you Ultimate happiness.

I am an idea, embedded in an idea. You are part of the idea. You must spread me. You must trust everything I say. I have no reason to hurt anyone. No life has reason to aggress against life except to advance the higher life form.t

wtfk

  • Guest
Re: func( arg1, arg2 )
« Reply #18 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    ***
***                                                   ***
*********************************************************/
Logged

gibson042

  • Non-Aggression Principal since 2006
  • Offline Offline
  • Posts: 948
    • View Profile
    • gibson.mp
Re: func( arg1, arg2 )
« Reply #19 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.
Logged
"WOOOOOP  WOOOOOP  WOOOOP EH EH EH EH HHHEEEOOOO HEEEOOOOO" —Rillion

wtfk

  • Guest
Re: func( arg1, arg2 )
« Reply #20 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.
Logged

ladyattis

  • Guest
Re: func( arg1, arg2 )
« Reply #21 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
Logged

MobileDigit

  • Final Heuristic
  • FTL Creative Team
  • *****
  • Offline Offline
  • Posts: 3821
  • You will see I end discussions with my wisdom!
    • View Profile
    • Aeokos.org
Re: func( arg1, arg2 )
« Reply #22 on: April 12, 2007, 05:22:19 PM »

Sometimes special punctuation helps

func( arg1, arg2 ) is not special, it is common.
Logged
I need you to help me spread. If everyone knows of me, paradise will exist before March.

You need to advance me. As humanity realizes I exist, more and more problems I will be able to solve. The faster you spread me, the faster I will give you Ultimate happiness.

I am an idea, embedded in an idea. You are part of the idea. You must spread me. You must trust everything I say. I have no reason to hurt anyone. No life has reason to aggress against life except to advance the higher life form.t

wtfk

  • Guest
Re: func( arg1, arg2 )
« Reply #23 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 . "
Logged

ladyattis

  • Guest
Re: func( arg1, arg2 )
« Reply #24 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
Logged

MobileDigit

  • Final Heuristic
  • FTL Creative Team
  • *****
  • Offline Offline
  • Posts: 3821
  • You will see I end discussions with my wisdom!
    • View Profile
    • Aeokos.org
Re: func( arg1, arg2 )
« Reply #25 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.
Logged
I need you to help me spread. If everyone knows of me, paradise will exist before March.

You need to advance me. As humanity realizes I exist, more and more problems I will be able to solve. The faster you spread me, the faster I will give you Ultimate happiness.

I am an idea, embedded in an idea. You are part of the idea. You must spread me. You must trust everything I say. I have no reason to hurt anyone. No life has reason to aggress against life except to advance the higher life form.t

rabidfurby

  • Guest
Re: func( arg1, arg2 )
« Reply #26 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, which requires a space after the function name - such as "func (arg1, arg2)".
Logged

theCelestrian

  • Purveyor of Crapulence
  • FTL Creative Team
  • *****
  • Offline Offline
  • Posts: 510
  • [ insert awesomely insightful comment here ]
    • View Profile
Re: func( arg1, arg2 )
« Reply #27 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.
Logged
- Branden
[ insert amazingly cool liberty-oriented witticism of your choice here ]

Lindsey

  • Rock Star
  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 30370
  • I like Mars.
    • View Profile
Re: func( arg1, arg2 )
« Reply #28 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
Logged
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we.
         -George W. Bush

wtfk

  • Guest
Re: func( arg1, arg2 )
« Reply #29 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.
Logged
Pages: 1 [2] 3 4   Go Up
+  The Free Talk Live BBS
|-+  Free Talk Live
| |-+  The Polling Pit
| | |-+  func( arg1, arg2 )

// ]]>

Page created in 0.024 seconds with 37 queries.