Writing code that is easy to read is a critical step for producing high quality software. Code that is hard to read is difficult to reason about (both for yourself and your code reviewers), which makes it more likely that bugs will escape detection and affect users. Code that is hard to read is also difficult to change (since it is hard to understand), which makes it more difficult to add new features that users want or even to fix bugs in the code without introducing more bugs.

Overview

Part of your grading in the coding assignments will focus on the readability of the code you write. This includes two key parts:

The following sections provide detailed rules to follow, most of which follow from the two points mentioned above.

Naming

Formatting

Indenting

Commenting

Scope

Types