Home Basic expectations for commenting

On commenting

Comments are specially marked lines of text in your code that can be used to describe what's happening in your program. Java ignores comments when it runs your program – rather, comments exist for the benefit of the human reader.

In particular, comments make it easier for humans to understand how to use and modify your code. This is particularly important when working on more complex projects. Larger projects can be hundreds of thousands to millions of lines long, and comments are a useful tool for helping guide somebody new to the codebase.

Class header comments

You must always include class header comments for every class you write. Your class header comment must include metadata (your name, date, assignment, TA, etc), and a description of the class as a whole. Assume that whoever is reading the description is unfamiliar with the assignment.

Do not plagiarize

Your comments should be written in your own words. You should not directly copy-and-paste any text from the spec.