Skip to main content
eScholarship
Open Access Publications from the University of California

UC Berkeley

UC Berkeley Electronic Theses and Dissertations bannerUC Berkeley

Designing Exercises to Teach Programming Patterns

Abstract

As digital technologies continue to grow in importance and influence, the need for strong programmers continues to grow. ``Programming,'' though captured by a single word, actually requires the acquisition of many different skills. One such skill is identifying where and how to apply programming patterns --- reusable abstractions and organizations of code. This skill has been shown to be a distinguishing characteristic between experts and novices.

However, our current Computer Science classrooms offer scarce opportunities for students to deliberately practice patterns through exercises. The most common code practice tool is the Code Writing exercise; the goal it presents to students is to construct a program that matches certain outputs from given inputs. Code Writing exercises offer minimal affordances to guide students towards particular solutions, making it difficult for instructors to ensure students will practice a specific pattern.

This work introduces three new exercises designed to support students in acquiring new patterns. In Faded Parsons Problems, students rearrange and complete lines of code to reconstruct a program. In Subgoal Decomposition exercises, students reconstruct the execution flow of subgoals across multiple files and languages, specifying where each subgoal fits in an architectural framework. In Data Flow exercises, students further concretize each subgoal by using code snippets to specify the data processing for which each subgoal is responsible. Each of these exercises were designed to be easy to adopt into existing curricula without significant changes, complementing existing Code Writing exercises. Studies with students revealed that each of these exercises addresses currently unmet needs in CS courses, that these exercises support students practicing patterns by allowing students to focus on the full solution, and that students want these exercises to be integrated into their courses. Additionally, a classroom-based study with 237 students found that Faded Parsons Problems are more effective than Code Tracing and Code Writing exercises at helping students acquire patterns while also improving their general code writing abilities. Finally, from the lessons learned in developing these exercises, five design goals are presented to motivate the creation of more exercises for new contexts.

Main Content
For improved accessibility of PDF content, download the file to your device.
Current View