Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Coding Methods

  1. #1
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30

    Coding Methods

    What is the correct way to program. In certain languages you should post the { on a new line like

    if (a == b)
    {

    And then in others you post on the same line

    if (a == b) {

    I prefer the method above. I try to leave a comment above anything major such as

    // This determines ......
    if (a == b) {

    and of course an explanation above every function. If I have a nest IF/FOR/function statment I try to comment the ending }

    Code:
    // Main Function
    void main() {
     
      // The Dermines .....
       if (a == b) {
           code.....
       } // End If
    
    }

    What standard do you guys use?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    NeedHelp Guest
    I use similar although I put the bracket { on a new line like
    if (a == b)
    {

    I think it looks cleaner.

  4. #3
    sigs is offline Learning Programmer
    Join Date
    Apr 2006
    Posts
    34
    Rep Power
    0
    i would prefer starting the new command in a new line. its always better to do so as far as i think.

  5. #4
    moonrise is offline Learning Programmer
    Join Date
    May 2006
    Posts
    40
    Rep Power
    0
    i also use to put in a new line only

  6. #5
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22

    The One True Brace Style

    As everyone should know by now, the K&R style of putting the brace at the end of the line is The One True Brace Style.
    However, VS.NET does (by default) force you to use the inferior BSD/Allman style of taking an entire line for a single brace.
    That's why I prefer VB.NET.

  7. #6
    Crane's Avatar
    Crane is offline Programming Expert
    Join Date
    Nov 2005
    Posts
    398
    Rep Power
    25

    Smile

    Quote Originally Posted by brackett
    As everyone should know by now, the K&R style of putting the brace at the end of the line is The One True Brace Style.
    However, VS.NET does (by default) force you to use the inferior BSD/Allman style of taking an entire line for a single brace.
    That's why I prefer VB.NET.
    I've never heard of the names for either style. Where did you learn about these? The admin needs to make a sticky about the two different styles.

    "The One True Brace Style" - lol

  8. #7
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    Quote Originally Posted by Crane
    I've never heard of the names for either style. Where did you learn about these? The admin needs to make a sticky about the two different styles.

    "The One True Brace Style" - lol
    I think I first came across the naming convention on somebody's C# blog that linked to the Wikipedia entry. Before that, I just defended the K&R style as being classic and wasting less lines - it also maps nicely to my preferred syntax - VB.NET. Then again, most of my C code is done in vi, so fitting as much as possible on a screen is pretty helpful.

  9. #8
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    Interesting. I've never heard of either style being named. I'm going to dig up some information on them.

  10. #9
    Frantic's Avatar
    Frantic is offline Learning Programmer
    Join Date
    May 2006
    Posts
    91
    Rep Power
    0
    I always put my {on the same line, its much easier to read.

    I end it though on a line of its own.

  11. #10
    dirkfirst is offline Programming Expert
    Join Date
    May 2006
    Posts
    354
    Rep Power
    23
    I have never heard names for them. I use "The One True Brace" style (where it is on a seperate line).

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Methods... think I over did it on the last one
    By wolfman in forum General Programming
    Replies: 4
    Last Post: 10-14-2011, 10:59 AM
  2. adding methods
    By justinb09 in forum Java Help
    Replies: 8
    Last Post: 05-10-2009, 01:57 PM
  3. More Coding Methods
    By RobSoftware in forum General Programming
    Replies: 2
    Last Post: 05-30-2006, 02:42 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts