Java Programming Style Guide
This Style Guide puts forth the coding standards, conventions, and guidelines used this quarter in CS 110 for writing correct, high-quality, and maintainable Java code. They are based on industry standards, although often reduced to a simplified form to teach the concepts yet keep the work load reasonable. By following these principles, you will be better able to produce code that is correct, requires less debugging effort, and is easier for the graders to follow.
In the real-world, code conventions are important to programmers for a number of reasons:
- 80% of the lifetime cost of a piece of software goes to maintenance. Hardly any software is maintained for its whole life by the original author. Code conventions improve the readability of the software, allowing software engineers to understand new code more quickly and thoroughly.
- Coding standards allow teams of programmers to more easily understand each others code and help spot errors. Rather than coding from scratch, team members are more likely to sharing and re-use code when the style and commenting conventions among team members are the same.
In CS110, code conventions are important for a number of reasons:
- This course is designed for CS pre-majors. It is important to learn correct coding practices from the beginning rather than adopting bad coding habits that will need to be corrected down the road.
- Care in following the coding conventions will reduce the number of logic errors in your code as well as reduce the debugging time required to fix your remaining logic errors.
- Your code is read by the TA graders and instructor. They will have an easier time understanding your code's logic and helping you debug your errors if everyone follows a consistent set of standards.