Code Legibility

When Does Code Need to be Legible?

In this course, you will be coding in programming languages such SQL and Python; the contexts in which you will be writing code includes homeworks, worksheets, and even the discussion board. All of this code must be legible, which we define as "is a skilled user able to understand the logic just by reading it?".

All of your code is reviewed by a human being, such as your professor or TA. Please write your code for them, not for a machine such as a compiler or an autograder. Notably, we -- your course staff -- must be able to understand your code without the assistance of automatic formatters ("linters"), compilers, or output from unittests.

What Does "Legible" Mean?

We do not grade on compliance with a specific style guide. Instead, we only ask that the code you write can be understood by a skilled human; in other words, that it's "legible".

Legibility is a lower bar than a specific style guide. For example, a specific style guide might require camelCase attribute names (thereby forbidding snake_case names); on the other hand, requiring legible code only means that you consistently follow a single naming convention.

In SQL, "legibility" typically means:

Similar conventions can be inferred for the other programming languages used in this class. However, if our definition of "legible" is too amorphous, then we recommend (but do not require) the following style guides: