How to answer a coding question on a test

Diane Curtis who works with college students wrote a great blog last week about answering an interview question that asks a candidate to write some code. This is a fairly typical sort of question that people are asked when interviewing for technical/programming jobs. As I read her post it I realized that the same steps are appropriate for almost any kind of programming problem including the sort that students are asked on written exams.

Now step one is a little different because in an exam one already has the question written out but one still has to read that question very carefully to understand all the information and assumptions. But the rest of the steps, on scrap paper until the final code writing step, is pretty close to what one could (should?) do for a test.

At the very least one wants or rather needs to have an organized step by step approach to a coding problem. This applies to a problem one is doing for a job just as much, if not more so, as to a test or an interview question.

I think that teaching problems solving may be the most important skill we can teach as part of a programming course. We can't rely on random unplanned code additions to solve problems. We need a process that involved checking what we are doing at each step. Planning gives the best results but we need to teach it.

 

Technorati tags: Interviews, coding