Monday, August 19, 2013

Naming Convention in Programming

Summary from wikipedia

Classes

- Name should be nouns in UpperCamelCase
- Use whole words (avoid acronyms and abbreviations)
- e.g. : class Raster; class ImageSprite

Methods

- should be verbs in lowerCamelCase
- first letters of subsequent words in uppercase
- e.g.: run(); runFast(); getBackground();

Variables

- written in lowerCamelCase
- should not start with underscore( _ ) or ($) characters
- should be used prefix all instance variables
- keep short and meaningful
- avoid one character
- e.g. : float myWidth

Constants

- should be written in uppercase characters seperated by underscores
- my contain digits if appropriate but not first character
- e.g.: final static int MAX_PARTICIPANTS

No comments:

Post a Comment