Naming conventions: Difference between revisions

Content added Content deleted
Line 527: Line 527:
// a module name is the name of the app or library, followed by the domain name of the organization;
// a module name is the name of the app or library, followed by the domain name of the organization;
// alternatively, a "throw-away" module can have a simple name, like "TestApp"
// alternatively, a "throw-away" module can have a simple name, like "TestApp"
module shop.acme.com
module shop.acme.com {
{
// other than modules, all type and class names (including enum values) use upper CamelCase;
// other than modules, all type and class names (including enum values) use upper CamelCase;
const Point(Int x, Int y);
const Point(Int x, Int y);
enum Color {Red, Green, Blue}
enum Color {Red, Green, Blue}
interface Callback
interface Callback {
{
// variables, properties, methods, and functions using lower camelCase
// variables, properties, methods, and functions using lower camelCase
Boolean active;
Boolean active;
void onEvent(String event);
void onEvent(String event);
void onError(Exception e);
void onError(Exception e);
}
}


// constants use upper CamelCase, or in some cases, UPPER_SNAKE_CASE
// constants use upper CamelCase, or in some cases, UPPER_SNAKE_CASE
Line 546: Line 544:
// type variables are named for their meanings, and use upper CamelCase
// type variables are named for their meanings, and use upper CamelCase
interface Bag<Element>
interface Bag<Element>
extends Iterable<Element>
extends Iterable<Element> {
{
void add(Element e);
void add(Element e);
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>