View Poll Results: Do you prefer your code organized?

Voters
17. You may not vote on this poll
  • Yes, both commented and indented correctly at all points.

    13 76.47%
  • Mostly commented correctly, with a few indents where I find necessary.

    1 5.88%
  • I occasionally use comments and indents.

    2 11.76%
  • It is not entirely necessary to comment and indent code.

    1 5.88%
Results 1 to 17 of 17

Thread: Organized Code

  1. #1

    Thread Starter
    Lively Member H-Zence's Avatar
    Join Date
    Jul 2002
    Posts
    94

    Post Organized Code

    This poll is just to determine how many people actually take the time to organize their code, and organize it well. Just out of curiosity
    www.mindset1.com
    Religious Debate Forums

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Organized code can be the key to success. You'll thank yourself later.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I don't use comments but I always, ALWAYS use correct indentation and spacing. Just to make it easy to skim through, I will occasionally add 'stage' comments in long functions and procedures.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695
    I use indentation but comments are only if something is new for me and its the first time I am using...

    when I am used to that bit of code I remember it and I don't use comments any more...

    Cheers...

  5. #5
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    When you write any program ALWAYS think maintenance which means as much comments as possible as you might not be the one that will ever support that piece of art (read "crap").
    Roy

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    If something is either partially complicated or really involved, I'll comment it.

    I can't count the times I'll look at code I wrote months ago and have no idea what's going on.

    Always use Option Explicit, too. It's the best coding practice to get into the habit of doing.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7
    Addicted Member jmiller's Avatar
    Join Date
    Jul 2002
    Location
    University of Michigan
    Posts
    238
    i'm with sastraxi, i ALWAYS use indents, only occasionly with something obscure do i use comments

  8. #8
    Fanatic Member Vanguard-MnC's Avatar
    Join Date
    Apr 2002
    Location
    Inactive for like ever.
    Posts
    628
    I make lines with comments after the normal horizontal lines on vb, like this:

    VB Code:
    1. '====================================================================

    because it's easier to see than the regular lines...
    and I always indent correctly.

  9. #9
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Sometimes I'll tab out my nests.

    Depends on my laziness.

  10. #10
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Originally posted by The Hobo
    If something is either partially complicated or really involved, I'll comment it.

    I can't count the times I'll look at code I wrote months ago and have no idea what's going on.

    Always use Option Explicit, too. It's the best coding practice to get into the habit of doing.
    Amen to both of those. Besides "normal" comments I annotate my code like the following when making changes.

    VB Code:
    1. '******* 12.00.004 #2 Start *******
    2. '    For InIndex = 0 To cboRules.ListCount - 1
    3. '        cboRules.RemoveItem intIndex
    4. '    Next
    5.     cboRules.Clear
    6.     '******* 12.00.004 #2 End *********

    The above would tell me that I replaced the loop with the Clear statement in release 4 of version 12.0 of my app. BTW, I wrote a liitle add-in that helps me with the annotation.

  11. #11
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    Commenting is something is i forget sometimes, but indentation has become second nature to me. I can't imagine coding without indentation.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  12. #12
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Here's a question: Indentation - do you have it set at 2 or 4 spaces?

    I've seen some people's code where it's at like 8 and it bugs the crap out of me. I'm very picky about my code.

    I also don't like this:

    VB Code:
    1. Dim var As Type
    2. Dim var As Type
    3. Dim var As Type
    4. Dim var As Type
    5. Dim var As Type
    6. Dim var As Type

    I'd rather have it:

    VB Code:
    1. Dim var As Type, var As Type, var As Type
    2. Dim var As Type, var As Type, var As Type
    My evil laugh has a squeak in it.

    kristopherwilson.com

  13. #13
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    mines 4, 2 is too close to see, and 8 goes off the screen too quickly. I prefer the first option on the variable declaration though. . it is easier to read when the variables names are different lengths
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  14. #14

    Thread Starter
    Lively Member H-Zence's Avatar
    Join Date
    Jul 2002
    Posts
    94
    Personally, I'm very picky about my code. I told some of you about my Tic Tac Toe game (T3-2K5). If you want to see that code, go to www.planetsourcecode.com and just search for T3-2K5 under the VB category. Download it and look at my code, that'll give you an idea. Almost every line is commented (which i admit is a bit ridiculous ) and every indent is correct.
    www.mindset1.com
    Religious Debate Forums

  15. #15
    Addicted Member
    Join Date
    Sep 2002
    Location
    Ontario, Canada
    Posts
    134
    Well I indent, but I NEVER comment

  16. #16
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963
    I'd rather
    VB Code:
    1. Dim var As Type, var As Type, var As Type, _
    2. var As Type, var As Type, var As Type, _
    3. var As Type, var As Type, var As Type, _
    4. var As Type, var As Type, var As Type
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

  17. #17
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by jian2587
    I'd rather
    VB Code:
    1. Dim var As Type, var As Type, var As Type, _
    2. var As Type, var As Type, var As Type, _
    3. var As Type, var As Type, var As Type, _
    4. var As Type, var As Type, var As Type
    I might do that sometimes, but I'd do backwards indentation:

    VB Code:
    1. Dim var As Type, var As Type, var As Type, _
    2.     var As Type, var As Type, var As Type, _
    3.     var As Type, var As Type, var As Type, _
    4.     var As Type, var As Type, var As Type
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width