Beautiful Code
CS2 / Java
Abstract
Inspired by Robert C Martin’s Clean Code book, this activity covers the basics of what makes code readable and understandable. As the students are preparing to spend a semester building a medium-sized Java application, it is important to build good habits for naming variables and methods in an intention revealing way, be methodical and consistent about indenting code blocks, be intentional about ordering methods of a class, and avoiding code duplication by creating generalized methods. The students work through these topics by exploring a model from a computerized card game. After completing this activity, the students will be able to describe the rules for writing readable code, identify opportunities for improving code readability, and explain the dangers of code duplication.
This activity was developed with NSF support through IUSE-1626765. You may request access to this activity via the following link: IntroCS-POGIL Activity Writing Program.
- Level: undergraduate
- Setting: computer classroom
- Activity type: Learning Cycle
- Discipline: Computer Science
- Course: CS2 / Java
- Keywords: naming variables & methods, code indentation, class organization, duplicate code
Downloads
Published
How to Cite
Issue
Section
License
Copyright of this work and the permissions granted to users of the PAC are defined in the PAC Activity User License.