How to Study Computer Programming: Parsons Problems

Michael McMillan
May 23, 2020 · 6 min read
Image for post
Image for post
Photo by Markus Spiske on Unsplash

A Parsons Problem is a complete, though usually short, computer program where the lines of the program are mixed up and the person solving the problem must put the lines into the right order. In this article I’ll discuss why Parsons Problems are good for studying computer programming and I’ll show you some web-based programs you can use to generate your own Parsons Problems.

A Short Parsons Problems Example

Here is an example JavaScript program demonstrating how to swap the contents of two variables:

let value1 = 2;
let value2 = 200;
let temp = value1;
value1 = value2;
value2 = temp;

We can mix this program up to make a Parsons Problem like this:

value1 = value2;
let temp = value1;
let value2 = 200;
value2 = temp;
value1 = 2;
value1 = value2;
let value1 = 2;

The student then takes this Parsons Problem and rearranges the program to either recreate the original version shown above or a variation where the variable initialization order is changed.

Web-based Parsons Problems sites allow students to solve Parsons Problems by either using line numbers in the program or presenting the code as a set of blocks that can be dragged and dropped into the correct order. I’ll demonstrate some Parsons Problems web sites later in the article.

Why are Parsons Problems Useful for Programming Study?

One of the biggest mistakes students learning computer programming make is spending all their time practicing writing code. While writing code is important and is an obvious skill for a computer programmer, it is not the first thing a programming student should be studying.

The first thing a programming student should be studying is reading and interpreting computer programs. There are several techniques you can use here, such as variable tracing, but Parsons Problems are a known effective study tool. Barbara Erickson, a computer science education researcher at the University of Michigan, has studied Parsons Problems for several years and even wrote her PhD dissertation on a type of Parsons Problems. You can find out more about her research here.

In her research, Erickson has found Parsons Problems to be more effective in learning computer programming than either fixing code or writing code. Here is a direct quote from her web site:

“I have tested Parsons problems against fix code and write code problems. Students solve Parsons problems significantly faster than fix code or write code problems with the same increase in performance from pre to post on assessment.”

Some Parsons Problems Web Sites and/or Generators

The best site I’ve seen for generating Parsons Problems is https://janke-learning.org/parsonizer/. This site will present you with a mixed-up program in the left pane. The code is block-based. You solve the problem by dragging the blocks into the right pane in the correct order. After you finish, you press the evaluate button and if the dragged code turns green, you solved the problem successfully.

Here is a screen shot of an initial problem for you to solve:

Image for post
Image for post
Start of a Parsons Problem Using Parsonizer

Here is a screen shot after solving the problem:

Image for post
Image for post
Solved Parsons Problem

This problem was automatically generated from the program but you can create your own problems by pressing the edit code button. The program will bring up an editing window where you can enter your own program, or for study purposes, have someone enter the program for you. Here is a screen shot of a JavaScript program to sum the elements of a numeric array:

Image for post
Image for post
Code to turn into a Parsons Problem with Parsonizer

If you press the parsonize button you get this screen:

Image for post
Image for post
Parsons Problem generated

And you can now solve this problem.

Another place you can find Parsons Problems is in the interactive textbooks published by Runestone Academy. The books at this site use a system called ActiveCode and one of the many features of ActiveCode is the ability to create interactive Parsons Problems in a book’s text. An example of this is shown in the screen shot below:

Image for post
Image for post
Runestone Academy Parsons Problem Example

Runestone’s Parsons Problem generator also uses code blocks you drag and drop into order. As you can see, once you drag the code blocks into place, there is a Check button you can click to see if your work is correct, as is shown below:

Image for post
Image for post
Runestone Academy Parsons Problem solved

The last Parsons Problem generator I’ll mention is the one found in the development tools for the Codio system of interactive computer programming tools. Go to this link to see a short interactive demo of the Codio Parson’s Problem generator and here is a screen shot of the demo they provide in their blog:

Image for post
Image for post
Codio Blog Entry on Parsons Problems

An Open-source Parsons Problems Generator

If you are interested in playing around with Parsons Problems and know some JavaScript, there is an open-source Parsons Problems generator that is the code base for the Parsonizer program we saw in the last section. Go here to download the source code for the Parsons Problems generator web site.

I am currently working on a project where I use this code along with a database of short programs so that the user is just presented with a new Parsons Problem to solve in the language of their choice rather than having to supply the original program themselves.

When to Use Parsons Problems

I teach computer programming using a four-step approach for all programming constructs that takes the student from learning how to read and interpret code, to learning how to write code from simple problem descriptions, to learning how to read programming templates to solve common programming problems, to finally being able to use a programming template to solve a unique programming problem.

Parsons Problems should come at the end of step 1 as the student is learning how to read and interpret code. Parsons Problems could also be used during step 2 as scaffolding for learning how to write code by learning how to organize mixed up code into a logical order.

A Final Word on Parsons Problems

There are a lot of different techniques you can and should use for learning how to program. The first step is to learn how to accurately read code and interpret what it is doing. This usually starts with learning the syntactic rules of a programming language and then how to use the language to perform computational tasks. Solving Parsons Problems is one tool you should use in learning how to interpret programming code.

Thanks for reading this article and please email me with comments and suggestions.

The Startup

Medium's largest active publication, followed by +756K people. Follow to join our community.

Michael McMillan

Written by

Mike McMillan writes about computer programming and running. He is setting up his new web site at https://michaelmmcmillan.com.

The Startup

Medium's largest active publication, followed by +756K people. Follow to join our community.

Michael McMillan

Written by

Mike McMillan writes about computer programming and running. He is setting up his new web site at https://michaelmmcmillan.com.

The Startup

Medium's largest active publication, followed by +756K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store