Software Design and Development :: CS 246

CS 246 - Code Conventions and Style

Overview

An important component of software development, especially when working with others, is learning to use a consistent programming style. This is especially important when multiple developers are contributing to the same codebase.

Using a consistent style in a project provides the following benefits:

Style Guides

Most languages have a generally accepted style guide for that language. In addition, many companies have their own software style guides. Learning to follow a style guide is an important skill.

In this course, we will use one of the most popular style guides for Java programming, the Google Java Style guide.

This style is likely different than what you're used to using when programming in C++. For example, it uses the “K & R style” of braces (Style Rule 4.1.2), where the opening brace appears on the same line as the method name or if statement:

if (expression) {
   statement;
   statement;
}

Please take some time to become familiar with the style guide, especially the formatting requirements from section 4.