indent |
---|
{color:green}Have any suggestion on how improve this wiki? Please give us your feedback at [mailto:csf-support@mit.edu]{color}
|
Panel | ||||
---|---|---|---|---|
Quick Links to:
|
Panel | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
The SAIS Framework generally follows the code conventions set by the Java programming language that can be found at http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html For the purposes of this document, we'll highlight those areas that seem to be most frequently overlooked, and ways in which we might deviate from the standard. Line LengthJava specifies a line length of 80 characters "since they're not handled well by many terminals and tools." We find this limitation to be a little outdated. Modern screens and development environments can easily accommodate many more characters than 80, and limiting to 80 makes code especially unreadable. Class and Interface DeclarationsWhen coding Java classes and interfaces, the following formatting rules should be followed:
E.g.,
if, if-else, if else-if else StatementsThe if-else class of statements should have the following form:
do-while StatementsA do-while statement should have the following form:
try-catch StatementsA try-catch statement should have the following format:
A try-catch statement may also be followed by finally, which executes regardless of whether or not the try block has completed successfully.
|