Packages:
Names should be in lowercase. With small projects that only have a few packages it's okay to just give them simple (but meaningful!) names:
package mycalculator
Classes:
Names should be in CamelCase. Try to use nouns because a class is normally representing something in the real world:
class Customer
class Account
Interfaces:
Names should be in CamelCase. They tend to have a name that describes an operation that a class can do:
interface Comparable
interface Enumerable
Note that some programmers like to distinguish interfaces by beginning the name with an "I":
interface IComparable
interface IEnumerable
Methods:
Names should be in mixed case. Use verbs to describe what the method does:
void calculateTax()
string getSurname()
Variables:
Names should be in mixed case. The names should represent what the value of the variable represents:
string firstName
int orderNumber
Constants: Names should be in uppercase.
static final int DEFAULT_WIDTH
static final int MAX_HEIGHT
Private:
Camel Case and prefix private variable with a “_”Names should be in lowercase. With small projects that only have a few packages it's okay to just give them simple (but meaningful!) names:
package mycalculator
Classes:
Names should be in CamelCase. Try to use nouns because a class is normally representing something in the real world:
class Customer
class Account
Interfaces:
Names should be in CamelCase. They tend to have a name that describes an operation that a class can do:
interface Comparable
interface Enumerable
Note that some programmers like to distinguish interfaces by beginning the name with an "I":
interface IComparable
interface IEnumerable
Methods:
Names should be in mixed case. Use verbs to describe what the method does:
void calculateTax()
string getSurname()
Variables:
Names should be in mixed case. The names should represent what the value of the variable represents:
string firstName
int orderNumber
Constants: Names should be in uppercase.
static final int DEFAULT_WIDTH
static final int MAX_HEIGHT
Private:
No comments:
Post a Comment