Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In my C++ intro class last semester, all of our tests were paper/pencil and we had to write out code with a pen or pencil in order to answer questions. It seemed counterintuitive at the time, but also made sure students knew the answer down to the last semi-colon.

Given that handwriting notes is an essential practice in learning other topics both in the class room and at home, how productive is handwriting code examples and documentation?

share|improve this question

closed as primarily opinion-based by Corbin March, psr, MichaelT, Dynamic, GlenH7 Aug 15 '13 at 13:21

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

10  
From the perspective of someone who has taught, it was probably done to make cheating more difficult. The fact that yes people do retain knowldge better when they have hand-written it is a side benefit. –  HLGEM Aug 14 '13 at 14:33
2  
Then try to compile it. –  user61852 Aug 14 '13 at 18:00
6  
It allows for graphologists to identify who introduced bugs. –  user61852 Aug 14 '13 at 18:51
2  
God... Good God, no. The mere thought horrifies me. –  Jeff Gohlke Aug 14 '13 at 22:44
1  
I don't know much about theories. In my university time, there are 2 classes of fundamental programming. The class in which the professor requires students to write code to paper generally performs better to the other class. I think it has something to do with "you should think about the solution before you write code". –  Hoàng Long Aug 15 '13 at 9:10
show 2 more comments

11 Answers 11

Is handwriting out code an efficient way to learn a programming language?

It is an efficient way to learn and remember fundamentals of the programming language. In addition, it helps and improves your understanding on how code works, you get better understanding of inner-workings.

It is also a good block against copy-paste trend which tends to have quick results for newbies without a clue what is happening in the code.

However, for productivity reasons having a set of tools is must. As example, you may accomplish your tasks n times faster with Visual Studio IDE than a Notepad++ and C# .NET compiler.

Thus, right set of tooling is very important factor for productivity.

More about dangers of copy-paste discussed in this post.

share|improve this answer
    
perhaps you meant copy-paste? (I hesitate to make a one char edit) –  Dan Pichelman Aug 14 '13 at 14:19
    
grammar corrected :) –  Yusubov Aug 14 '13 at 14:20
add comment

I always found it to be a complete waste of time. You have no idea whether that code compiles or does what you expect, and measuring what you expect to work against reality, and then researching why the two might be different, is how we learn things.

When I was learning I kept detailed hand-written notes of common library functions, but then somebody invented something called the internet and all hell broke loose. Libraries are sometimes updated faster than my ability to write so my notes often got stale very quickly, not to mention that you can search online documentation but not handwritten notes.

Of course, everyone learns differently so perhaps this is the most effective method for you - your mileage may vary...

share|improve this answer
add comment

In my experience it's not that productive at all. For example, it's very hard to insert a blank like between two existing lines of code when it's written on paper!

However, it's not uncommon during an interview to be asked to write out code on paper in order to answer a question. I also make sure I take a pencil with an eraser on top, as this can be tough when you've only got a pen!

share|improve this answer
    
For sure, writing code on paper and then transcribing it to computer is not a very productive development habit. But for learning, the hassle of editing actually reinforces the learning. To get that blank line, you have to delete some of your code and rewrite it - forcing you to review it one more time. –  emory Aug 14 '13 at 20:08
add comment

I think it has pretty limited benefit. It may assist in learning the syntax of the language, but once you start actually using the language itself, writing code you can't execute doesn't help much. It's probably a useful exercise for the first couple of weeks of an introductory course, but after that I think you'll see more benefit from running your code through the compiler (or at least a syntax-checker).

share|improve this answer
add comment

I will note that when following a tutorial, typing out the code (rather than downloading it or copy/pasting it) is a better way to learn. It tends to generate more thought about what your typing. And every time you misread the code (and thus, trigger an error), it forces you to put in extra work. You can improve learning even further by never looking at the code you are copying while you type it. Aversion to wasted effort is a memory enhancer.

share|improve this answer
add comment

I completely second what Yusubov says: it might be a good way to teach you the fundamentals of a language. I would even say: it might contribute to teaching you the fundamentals of programming.

What I wanted to add here is that it helps make a clear distinction between the language you're learning and the tools you're using. Working in a modern environment doesn't necessarily make this distinction very clear.

Is handwriting code an efficient way of learning a programming language? Yes, it can contribute positively to learning the language in the early days. How productive is it? Not very much.

share|improve this answer
add comment

Being able to handwrite understandable code is an important skill for whiteboard meetings (explaining an alternate or better algorithm to the team, etc.)

Being able to write correct code without the compiler and unit tests to do the checks for you puts less of a load or dependency on those tools and their (theoretically imperfect and often many) holes in their coverage.

share|improve this answer
add comment

The main advantages of handwriting is it generally helps concentrate on what you are doing, so when you finally do the coding, you know exactly what you are doing. The downside is that it can be counter-productive. I find it better to handwrite algorithms and "type" the actual code.

share|improve this answer
add comment

For me, learning a new language also includes learning the environment you will be using it in.

And the best way for me to learn a new language is to actually program in it, and by that I mean actually program and run a small application, so I can see the results, not by trying to program on paper.

share|improve this answer
add comment

I think it's not about productivity, it trains programming mindset. Before a fairly easy problem (like count prime numbers in first n integers), 9 out of 10 students might think that they know the answer and start typing. But very likely, their solutions miss some edge-cases, or not the optimized way.

One of the benefit of writing code instead of typing is that it forces students to think before typing. It's easy to insert/delete a code line, but it isn't so easy to write between paper lines. Even if they do write between the lines, the imperfect writing gives hint about their imperfect approaches, which imply some space to improve.

As my comment above:

In my university time, there are 2 classes of fundamental programming. The class in which the professor requires students to write code to paper generally performs better to the other class (in a programming contest which uses real computer)

Of course, the above quote is only my observation, but it gives a hint about how it works.

share|improve this answer
add comment

Code examples

You cannot compile a piece of paper. Even if your teacher looked through your papers he may not find all the compile errors. A computer does this, now and everytime. Seeing your program function will make you feel that you have achieved something. You can see that what you write works!

If the code is for a throw away purpose - learning concepts and the like - there might be some truth to hand writing. But it could just aswell be written on a computer, speeding up your writing.

Documentation

If you're a programmer you'll be sitting in front of the computer most of the time. If you're sharing a code snippet with your colleagues you're better off sending it through chat. It will also ease your mind, to see your code built/running before sending it.

It's too hard to update/share hand written documentation. It will probably be outdated once it is printed.

Overall

You would repeat yourself by writing code on paper, as it would have to be copied to the computer at some point - thus violating the DRY principle. You write code once, and read it many times.

share|improve this answer
    
The point is not to verify the syntax. The idea here is that you wouldn't care much about minor syntax issues, so long as it's clear the student understands what they're trying to do. You also wouldn't be doing it in situations where you'd need to copy it onto a computer; it's merely for the teacher to look over the content and verify the student understands some particular concept. Unless people have very poor handwriting, this isn't dramatically different on paper vs electronically. –  Servy Aug 14 '13 at 19:00
1  
Some particular concept? He wants to learn a programming language (that's what in the title). Skipping syntax errors will not help him accomplish this. He would want to test his code in order to see if he has learned the language. Making mistakes and correcting them is the biggest part of learning. You should never assume your code is working, prove it. He may learn "concepts" writing code on paper, but I do not see the reason to not use a computer in this situation. Why wouldn't you want to see your concept running? –  Peter Rasmussen Aug 14 '13 at 19:28
1  
He's hoping to discuss the merits of a particular technique commonly used in many classroom settings. It would of course not be the only method used; you wouldn't exclusively program on paper; you would do so to serve a particular purpose, and you wouldn't use it if the goal is to focus on learning syntax. –  Servy Aug 14 '13 at 19:31
    
He is not only looking for merits. As I wrote, I don't see what you would get from writing by hand, that you wouldn't get on a computer - using an IDE would give you even more. –  Peter Rasmussen Aug 14 '13 at 19:41
1  
There are a number of advantages, as discussed throughout the other answers and comments. Consider reading some of them. It prevents users from copy-pasting code, thus encouraging them to reduce redundancies that copy/paste doesn't discourage. It ensures that the programmer isn't using external resources (sometimes advantageous, sometimes not, depending on context), it has a much lower barrier to getting started (you can start within a few seconds of getting in a new class, vs installing an IDE, getting over the IDE learning curves, etc.), some people simply learn more effectively that way. –  Servy Aug 14 '13 at 19:47
show 4 more comments

protected by Yusubov Aug 20 '13 at 18:23

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.