Table of Contents
Fetching ...

Teaching Program Decomposition in CS1: A Conceptual Framework for Improved Code Quality

Georgiana Haldeman, Judah Robbins Bernal, Alec Wydra, Paul Denny

TL;DR

A conceptual framework is presented that is grounded in the established code style principles, provides a systematic approach that can be taught to students as an actionable strategy to improve the program decomposition of their programs, and includes scaffolded exercises to be used in classroom activities.

Abstract

Program decomposition is essential for developing maintainable and efficient software, yet it remains a challenging skill to teach and learn in introductory programming courses. What does program decomposition for procedural CS1 programs entail? How can CS1 students improve the decomposition of their programs? What scaffolded exercises can instructors use to teach program decomposition skills? We aim to answer all these questions by presenting a conceptual framework that (1) is grounded in the established code style principles, (2) provides a systematic approach that can be taught to students as an actionable strategy to improve the program decomposition of their programs, and (3) includes scaffolded exercises to be used in classroom activities. In addition, this systematic approach is automatable and can further be used to implement visualizers, automated feedback generators and digital tutors.

Teaching Program Decomposition in CS1: A Conceptual Framework for Improved Code Quality

TL;DR

A conceptual framework is presented that is grounded in the established code style principles, provides a systematic approach that can be taught to students as an actionable strategy to improve the program decomposition of their programs, and includes scaffolded exercises to be used in classroom activities.

Abstract

Program decomposition is essential for developing maintainable and efficient software, yet it remains a challenging skill to teach and learn in introductory programming courses. What does program decomposition for procedural CS1 programs entail? How can CS1 students improve the decomposition of their programs? What scaffolded exercises can instructors use to teach program decomposition skills? We aim to answer all these questions by presenting a conceptual framework that (1) is grounded in the established code style principles, (2) provides a systematic approach that can be taught to students as an actionable strategy to improve the program decomposition of their programs, and (3) includes scaffolded exercises to be used in classroom activities. In addition, this systematic approach is automatable and can further be used to implement visualizers, automated feedback generators and digital tutors.

Paper Structure

This paper contains 18 sections, 5 figures.

Figures (5)

  • Figure 1: Global code and layout for the Garden problem.
  • Figure 2: Student decomposition that violates the single responsibility principle.
  • Figure 3: Student decomposition that violates the reducing information passing principle as well as the single responsibility principle.
  • Figure 4: Exercise requiring drawing two owls (identical shape) separated by a random distance using ASCII characters. This exercise combines feature duplication (the owl parts are identical) with structural duplication (each row contains the same owl part printed twice with a random number of spaces or = characters for the branch in between). To increase reusability, one may chose to write only one procedure for drawing each row that takes in an owl feature and the in-between feature (either spaces or = characters for the branch).
  • Figure 5: Depiction of the program decomposition corresponding to the student code in Figure \ref{['fig:garden_ex1']} and its corresponding correction using the coloring procedure of its Data Dependency Graph (DDG) described in Section \ref{['subsec:visualizations']}. Each node in the DDG represents data that is either inputted or computed and the arrows depict the dependencies between nodes. Black arrows signal that the dependency also requires the data to be passed from one procedure to another. Each color represents a separate function, namely, gray for main, yellow for plants, purple for soil and green for fill_area. The correction corresponding to the violation of the single responsibility principle is shown in the red box on the left side of the figure. The circle_area node and the nodes it depends on (such as the pi node) must be split away as a separate function because the information it stores is needed across three functions.