Thursday, March 06, 2014

When Knowing The Syntax Is Not Enough

This week has been hectic for a lot of reasons. Getting my grades and comments in for progress reports has just been part of it. I haven’t had the time or energy to write much at all other than comments for progress reports. But I have been doing a little reading and some thinking. Crystal Furman had a great post earlier this week that was really good. CODING COMPREHENSION is about how some students can understand the syntax and commands but new really comprehend what the code is doing.

What I see a lot of is students who can tell you how to set up a loop or a decision statement but can’t easily make the move to using them to solve problems. They understand the problem but they are not really sure how to apply code to solve it. It’s the age old problem that we are teaching a language and how to use it at the same time. But it is not a natural language so learning the words is not enough.

A lot of people point out block programming languages and how they remove syntax errors from the equation. And there is value to that. Students can create a loop and not get lost with semi colons or errors in case for keywords and that all makes some things easier. But if they don’t realize that a loop is what they need there is still a big problem. I’m starting to think that syntax is not as big a part of the problem of learning how to program as I used to think.

The biggest problem is helping students to think in programming. They need some help seeing how to apply the statements, keywords and other things that make up the mechanics of programing. There was some discussion about teaching coding comprehension on Facebook (and you thought it was just for cute cat pictures) in the AP Computer Science Teachers group.

The discussion there lead to people talking about giving students code snippets and asking them to explain, using only English words, what the code was doing. Some teachers reported students having real problems doing this. I imagine that is the case. One hopes that practice would help here though.

I think it is important not to get too tricky with the code samples we ask students to explain though. We don’t want to model poor coding practices. We don’t want students to think that writing tricky to understand and hard to read code is a good thing. It’s not! What we want them to learn is the right way to do things. Being able to understand tricky or poorly written code is something they will get plenty of practice with reading their own code.

How are others dealing with this issue? Do you have any lecture tricks? Any project suggestions? Are you asking students to explain code they didn’t write? Something else?

[Edit: Crystal Furman’s Teaching Computer Science blog is one of the great blogs on my Computer Science Education Blog Roll. Are you following them all? Know any I should add? Let me know.]

2 comments:

Garth said...

I am having the same problem; the step from knowing syntax to problem solving is reallllyyy big. What I am finding is it is more related to ambition and desire to learn to code than to how I present the material. I have kids that pay attention in class, ask questions and still do not have a clue. I have others who just want me to shut up so they can start fiddling with the problem and the code on their own. Those kids knock out a problem in no time and they understand what they did. I am still trying to find a happy medium.

Unknown said...

I have the same problem.
But as a beginning programmer.

I have not held any programming class. I learn languages (Obj-C and Ruby) by myself. It seems that I start to understand syntax. But I can not even imaging how do programmers decide how to write a Program.
I guess that boys described by Garth already have that idea, general flow. And they've got it not on his class.

How all these variables, methods, classes and cycles can form an Messenger (for instance)??

I started to search and found this post.So if have some book to advise or article or just an advice — I would appreciate it.

Thank you