Hacker News new | ask | show | jobs
by drtse4 5374 days ago
That's the way i did it fifteen or so years ago and it's the method i'll use if i had to teach an introductory course.

Pros:

- Using the trial&error approach to solve a problem is not efficient without a compiler, this forces you to think more carefully about the algorithm (and corner cases) instead of just typing out stuff until your algorithm "appears" to work.

- You'll learn to debug/test on paper, a skill that everyone must have.

Cons:

- Harder to learn the proper syntax without something that automatically shows errors? I'm not sure that this is a real issue...

2 comments

What I meant by learning syntax is that you have to think more about syntax when you're writing it on paper. When you're typing C++, you're not really thinking about where all the semicolons and braces go, it's all pretty automatic. If you want to learn to "think like a programmer" that means being able to forget about the syntax and focus on your problem.

That said, I have to agree that bench testing is an invaluable skill. I was able to impress a lot of my classmates by simply glancing at a program listing and pointing out the bug.

But why only paper?

I am not against using paper to do things like doing a diagram so you can understand your algorithm better and its shortcomings, and you're right, knowing how to debug on paper is important, but how do you know you have a bug if you can't test the code in a computer?

Our practice classes don't have computers on the classroom. This is not to say you can't do that at home, of course)

>how do you know you have a bug if you can't test the code in a computer?

Exactly. The idea with paper is that you need to get to the point where you go knowing what you're doing. If, like you said in the OP this is just for quizzes/tests, paper is a good way for a professor to see what you know when you sat down for a test, not what you were able to massage into compiling during the exam period. In 4 years of college, I the vast majority (all?) of my tests, exams, quizzes were on paper unless it was a project to do at home. For the most part, on-paper tests are about showing you understand the concept at hand, not that you dot every I and cross every T. If one of the concepts a test is going to test you on is that you have semicolons at the end of lines, you're going to get docked for it on that one, but every test after that it will be at worst a tiny deduction. They know what writing code on paper is like, just show them what they're looking for, and you'll be good.

>Our practice classes don't have computers on the classroom

This is what concerns me. Are you saying you don't have computers during you lecture, or is this a lab-type period where you're still working on paper?

It's a lab-type period (I don't know how you call these in the States) where we are still working on paper.

At least I assume we are since we didn't had this week's class, but I went to the classroom and it was an ordinary one.

I've just read below that it's a scheme course, i did a few lessons on that too and the approach was similar to what you describe. If with "bug" you are referring to syntax errors (being scheme, missing or wrong parenthesis), yeah, without a compiler/syntax checker it will be a bit hard to spot them sometimes. For algorithm testing, it's not different than what you'll do using a compiler, only slower (considering that testing usually involves testing various input combinations). Will, in this case, be a better course with the use of a compiler? Hard to tell, my impression is just that using only paper will make you focus more on the code you are writing, but this could not work for everyone.
Because it's not about code really, it's about design of the solution.

PSP (Personal Software Process) encourages the same thing: do your design on paper and debug it, then write the code, do a visual run through of the code, then run it. For short routines, it actually works very well. The problem is that if you've been programming for years, it feels very unnatural and requires a lot of discipline.