topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 18, 2024, 12:20 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Variable naming conventions  (Read 3800 times)

Tekzel

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 228
    • View Profile
    • Donate to Member
Variable naming conventions
« on: May 05, 2006, 05: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,900
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Variable naming conventions
« Reply #1 on: May 05, 2006, 05:57 PM »
a book like "Code Complete" would be a good place to start: http://www.amazon.co...p/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: 632
    • View Profile
    • Donate to Member
Re: Variable naming conventions
« Reply #2 on: May 05, 2006, 06:53 PM »
I second the Code Complete notion.  Excellent for thinking about such things.   :Thmbsup:
Insert Brilliant Sig line here