Home   Info   DevZone   Wiki  
UsersWeb  |  MainWeb  |  InfoWeb  |  DevZoneWeb  |  SupportWeb
CodingConventionsVarNaming ] [ not logged in ] [ Web: Imported ] goto:  options
[ get info on or edit ] login or new user ] [ list of topics, hubs & nodes, or recent changes ]


B) Here's another issue (more important) that brought to mind, from (of all things) a Java programming class:

Naming convention of variables that we use

In the labs and sample programs you see, we try to use a naming convention for our variables, that is we try to standardize how we name our variables. You are not required to follow it, but it may make things easier for you to understand.

  1. All ints start with 'i', like iNumStudents,iCreditHours

    EXAMPLES:
    	  int iNumStudents;
    	  int iCreditHours = 0;
    

  2. All floats start with 'f', like fGPA, fProbSuccess

    EXAMPLES:
    	  float fGPA;
    	  float fProbSuccess;
    

  3. All chars start with 'ch', like chGender, chLetterGrade

    EXAMPLES:
    	  char chGender;
    	  char chLetterGrade = 'A';
    

  4. All Strings start with 'str', like strPersonName, strStreetName

    EXAMPLES:
    	  String strPersonName = "Gromit";
    	  String strStreetName;
    	  Again, please note that 'c' is a character, while "c" is a String
    

  5. All parameters are named the same as the corrsponding member variables in "Set" methods.

    EXAMPLES:
    	  void setName( String strName )
    	  {
    		  this.strName = strName
    	  }
    

courtesy of http://www.cc.gatech.edu/classes/cs1502/lecture/sum97/lecture.1.html

Jason Hong's notes from the summer quarter CS1502 Java at Georgia Tech (Atlanta,GA,USA) archived on the College of Computing's webserver.

-BenKnowles


Return to CodingConventionsQuestions

Document Created Nov 8 1997 by ChrisSmith


Have a look at the HungarianNotation document!

MarkusPeter




Content of these pages are owned and copyrighted by the poster.
Hosted by: