DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Variable naming conventions  (Read 5,201 times)

Tekzel

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 228
    • Programming School - Stage 1 Medal
    • Programming School - Deluxe Bonus Medal
    • Military Service Badge - US Navy
Variable naming conventions
« on: May 05, 2006, 10:53 PM »
Well since I am trying to get back into coding, I guess I will get some opinions on a few things.  One thing I have always sort of struggled with, and have changed my method many times over the years, is variable naming.  My current way is pretty much a single letter to designate the datatype i expect to see in it (i for integer) and then a descriptive name, first letter of each word capitalized for enhanced readability.  I really have never worried much about standard conventions to facilitate others reading my code because, frankly I have never written anything anyone would ever want to read.  :)  But, who knows, if I can actually stick with it at some point I may be able to.

I also would like to see a few more threads on various, language agnostic if possible, ways to write code that is readable and such.  Also, maybe the more experienced guys (im looking at you Mouser!!) can give us some pointers on how to decide when to write functions to replace code blocks and when to just do it in place.  Here is one:  When do you write a class instead of a series of functions or methods?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Variable naming conventions
« Reply #1 on: May 05, 2006, 10:57 PM »
a book like "Code Complete" would be a good place to start: http://www.amazon.com/gp/product/0735619670

there are also some good sites with programming style guidelines.. let's see what others come up with.

Rover

  • Master of Smilies
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 633
    • Linux User
Re: Variable naming conventions
« Reply #2 on: May 05, 2006, 11:53 PM »
I second the Code Complete notion.  Excellent for thinking about such things.  :Thmbsup:
Insert Brilliant Sig line here

Original address: https://www.donationcoder.com/forum/index.php?topic=3504.0