Identifier Type
|
Naming Standards
|
Examples
|
Packages |
Package names should consist of
all lowercase characters and must begin with com.rational.cdshop. All
servlets are defined in the package com.rational.cdshop.servlets. |
com.rational.cdshop.business com.rational.cdshop.servlets.CDShopServlet.
|
Classes |
Class names should be nouns and
use a combination of upper and lowercase characters. The first letter of each internal
word should be capitalized. Class names should be simple and informative giving some
indication of the classs purpose. For all classes that interface to a
database should be of the following convention class XxxxDB.
All servlet classes for the ClassicsCD.com project should be of the following
convention CDXxxxServlet. |
- class OrderItem;
class CDCatalogServlet;
|
Interfaces |
All Interface class names
should begin with the letter I and should be capitalized like class names. |
interface IOrder |
Methods |
Methods should be verbs, nouns
and use a combination of upper and lowercase characters. The first letter of each internal
word should be capitalized. |
class CreditCard setType(int)
- setNumber(number) setExpDate(String)
|
Variables |
Variables should be nouns and
use a combination of upper and lowercase characters. The first letter should be lowercase
and the first letter of each internal word capitalized. Naming should be intuitive for
code comprehension by other team members. |
- class CreditCard
int type;
string number;
string expDate; string name; |
Constants |
Variable names declared as
class constants should capitalized. A variable name consisting of multiple words should
combine the words using an underscore ("_"). Constants are always declared as
static and final. |
static final int VISA_TYPE = 0; |
|