Beautiful Code

CS2 / Java

Authors

  • Kate Holdener Saint Louis University

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

2023-01-08

How to Cite

Holdener, K. (2023). Beautiful Code: CS2 / Java. POGIL Activity Clearinghouse, 3(4). Retrieved from https://pac.pogil.org/index.php/pac/article/view/346

Issue

Section

CS-POGIL Activity Writing Program