This document provides programming style guidelines including naming conventions, formatting, and declarations. It recommends using capitalization to distinguish class, method, and variable names. Class names should start with capital letters while variables and methods start with lowercase. Static methods should be accessed through the class name rather than an object instance. Declarations, fields, and constructors should be ordered and formatted consistently.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
20 views
Coding
This document provides programming style guidelines including naming conventions, formatting, and declarations. It recommends using capitalization to distinguish class, method, and variable names. Class names should start with capital letters while variables and methods start with lowercase. Static methods should be accessed through the class name rather than an object instance. Declarations, fields, and constructors should be ordered and formatted consistently.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
Programming Style (example)
Use names describing functionality
Capitalize parts
Begin class names with capital letters
Begin method, local and instance variable names with small letters ..
Good choice Poor choice
Professor myClass teachSections4to8 do cs1201Professor x More Programming Style DO
DON’T int numSectors // in circle int count, size int sectorSize // in degrees
For Static methods: classMethod();
AClass.classMethod(); anObject.classMethod(); More Convention Declarations only at the beginning One per line No literals (except for -1, 0, and 1 in loops) Qualify names fully
Access static methods by class name
Use parentheses liberally
Declare public only if necessary
Declaration "fields" then "method“, Constructor
first Initialize basic type fields at declaration