Results 1 to 5 of 5

Thread: Naming Conventions?

  1. #1

    Thread Starter
    Addicted Member The Phoenix's Avatar
    Join Date
    Aug 2003
    Location
    With my wife
    Posts
    142

    Naming Conventions?

    In my .NET Class, they teach us all these naming conventions. "pstrWhatever" for Procedure-level String variable, etc. However, I notice in a lot of the code I see posted here, they aren't used much. Are they something I should get in the habit of using, or are they more of a teaching tool, but something that I'll drop once I get into the "Real World"? I just want to know, so I know whether or not they are worht getting used to.
    Take my love
    Take my land
    Take me where I cannot stand
    I don't care, I'm still free
    You can't take the sky from me...

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    It's preference, who cares everyone ends up using something similar or different.

  3. #3
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    What you're talking about is the Hungarian Naming Convention and is generally standard practice or procedure in many development businesses. It is a good idea to become familiar with why and how it is used.
    the link below will help.
    Hungarian Naming Convention
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  4. #4

    Thread Starter
    Addicted Member The Phoenix's Avatar
    Join Date
    Aug 2003
    Location
    With my wife
    Posts
    142
    Okay, cool. Thanks Memnoch1207. That's what I wanted to know. Also, thanks for that link.
    Take my love
    Take my land
    Take me where I cannot stand
    I don't care, I'm still free
    You can't take the sky from me...

  5. #5
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    This convention may be standard among certain businesses... but depending on what firm you work for, you will have to adapt to their convention.

    Most people seem to consider that naming a variable should include what type of variable it is, the access level of the variable (public, private), and a descriptive name.

    For variables that simply increment through a loop (counters), many people simply use a lowercase i .... works for me, whenever i see it, I assume its not a very important variable and only holds scope for a short period of time.


    Additionally, function headers sometimes stray from conventions...


    Many C++ programmers also use _ (underscore), which personally is a pet peeve of mine. Although no one interprets it as an operator, it lends that impression, making the reading of the code less friendly than it should be. You see code in which that variable is used 10 times, and it looks messy in my view.

    String p_TempString;

    Personally, i rather use

    pTempString

    instead of:

    p_TempString
    p_strTempString
    pStrTempString

    In function headers, I use a lowercase l, don't ask why, but I like it...

    Round (lValuetoRound As Decimal, etc)

    Anyway, here's a good overview of C++ programming conventions

    "The experience of many projects leads to the conclusion that using coding standards makes the project go smoother. Are standards necessary for success? Of course not. But they help, and we need all the help we can get! Be honest, most arguments against a particular standard come from the ego. Few decisions in a reasonable standard really can be said to be technically deficient, just matters of taste. So be flexible, control the ego a bit, and remember any project is fundamentally a team effort. "



    http://www.chris-lott.org/resources/...gStandard.html
    Last edited by nemaroller; Aug 24th, 2003 at 12:49 PM.

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