Why Write Code on Paper?

Why Write Code on Paper?
School is about to start up for students all over the United States. And for those that are taking a computer science course for the first time, they’ll learn that it’s not always just typing code into a computer. So why do we write code on paper?

Many teachers and professors have their students write at least some of their code on paper, and then it’s hand graded rather than run through a compiler.

But why? For students this seems like a very odd thing. They’re learning to program a computer, but not using a computer.

Let’s take a step over to the other side and look at why this can be a good way to learn programming.

Ignoring What’s Not Important

For many students, especially when you’re first learning to code, programming can be very frustrating. You know exactly what you want the computer to do. But something as silly as forgetting a semicolon or not enough closing braces can cause your code to fail, full stop.

Let’s look at a bit of Java code that should find the biggest number in an array.

public class FindLargest {
  public int findLargest( int[] nums ) {
    int lg = Integer.MINVALUE;
    for (int i=0; i<nums.length(); i++) {
      if (nums[i] > lg) {
        lg = nums[i];
      }
    }
    return lg; 
  }
}

How close did I get?

There are two mistakes in the code above. Do you see them?

First, on the fourth line it should be Integer.MIN_VALUE, not Integer.MINVALUE. It’s missing an underscore. And on the next line it should be nums.length without the parenthesis.

Here’s a working solution.

public class FindLargest {
  public int findLargest( int[] nums ) {
    int lg = Integer.MIN_VALUE;
    for (int i=0; i<nums.length; i++) {
      if (nums[i] > lg) {
        lg = nums[i];
      }
    }
    return lg; 
  }
}

Look at this from the point of view of a teacher. How much “more correct” is the second than the first? If you had to grade the first, would you give the student a zero because the code wouldn’t build?

I know that I wouldn’t. In fact, I probably wouldn’t take off any points if I was grading this code on paper. The two mistakes really just don’t matter much.

And for those of y’all taking Computer Science AP-A in high school, minor issues like this are typically ignored in the scoring guidelines for the free response questions.

Focusing on What is Important

Looking back on the code above, what’s the important part? What do you think a teacher would want you to get out of an assignment like this?

Odds are you’ll see something like this during a unit on arrays. My guess is your teacher is checking whether you’re able to implement an algorithm correctly. Maybe checking for coding style.

Both of the examples above show a fairly decent algorithm to solve the problem of finding the largest value. And both show good style.

The missing underscore and extra parenthesis just aren’t important. The algorithm is.

When you write code on paper your instructor can focus on thought process that you went through. And sometimes you can turn in code that wouldn’t even come close to working or solving the problem, but your logic is very close. If not full credit, you should get most of the points available.

Take a look at the FRQ rubrics that the College Board has used over the past few years and see what they feel is important. There are several FRQs mixed in where you could get a majority of the points even if your code is nowhere close to a full working solution.

And if you are taking the Computer Science AP-A exam you will write code on paper. It’s half of the test.

Dependence on Tools

Programmers have some amazing tools. IDEs are exceptionally powerful and help you write code faster and more efficiently. Although some programmers like basic editors like vim, many use a full IDE like NetBeans or Eclipse because of the help that’s built in.

Unfortunately, dependence on these tools can make it more difficult to write good code. The most common issue I see is that students generally don’t remember the signatures for methods. Is it "chicken".subString(1, 2) or "chicken".substring(1, 2)?

Now, admittedly, whether the second s is capitalized or not falls under the What’s Important heading above, and it’s not something I’d take off for on paper.

The problem is that many coders will type a period after "chicken" and wait for the editor to pop up a list of available methods. If you don’t remember that it’s substring() to pull a string out of another string, just scrolling will help you find it.

The Language Doesn’t Matter

This one follows up on the previous section.

I would argue that in some cases it doesn’t even matter what language a student writes their code in.

Sure, if you’re taking a class in Java or C# you’ll need to turn in code that’s the right language. But what about in a job interview? Would it necessarily matter what language you use on the whiteboard to solve a problem?

It might, but it might not. They may just be looking at your logic.

Limiting Outside Resources

Yes, out in the real world if you forget how to make a text box on a JFrame you’re going to head to Google, probably wind up on Stack Overflow, and find a solution. There’s no realistic way to remember every method, of every library, of each language you know how to code in.

It’s different in the classroom. Your instructor likely wants you to focus on a very small subset of what you should know. Maybe you’re working with strings. Maybe you’re working with arrays.

And in that case, often your teacher will need a way to limit what you have access to. It has nothing to do with how coding works in the real world. It’s a way to check whether you know how a for loop works or whether you know how Google works.

Different Learning Styles

It’s a fairly common topic in teacher training that students have different learning styles. Some do better writing, some do better with videos, some learn best by teaching others, and a very small percentage do best by listening to lectures.

Current research shows that this might not be accurate, but educational research changes often.

That’s not what I’m talking about here though.

There’s quite a bit of research that shows students do better when writing notes compared to typing. The theory is that the act of moving your hand and writing out words embeds the information into your brain better than typing.

I don’t know of any research that correlates this directly with writing versus typing code, but it doesn’t seem like too much of a jump to make.

Get Off the Computer

And last, sometimes a teacher just might want to get students off the computer for a bit. A class where you do pretty much the same thing every day can be a very boring class.

But you can only do so many worksheets. Writing code on paper can be a good way to step away from the screen.

Not directly on topic, but if you’re looking for another way to get your students away from their screens CS Unplugged is a very good one.

What Else?

This is one of those topics that everybody doesn’t agree on. Some teachers have students do a portion of their assignments on paper, some never do. Some students truly hate writing code on paper, some find it beneficial. Though that’s true of any classroom activity.

What are your thoughts? Are you a teacher that has had good or bad results with your students writing code on paper? Are you a student that hates, or loves, to write code on paper?

Why ClassCube?

Are you spending too much time grading your students' source code?

ClassCube is an online tool for Computer Science teachers that allows you to create lab assignments for your students. They'll submit their code online and ClassCube will automatically grade it for you.

Teaching with ClassCube…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>