Difficulties with teaching and learning programming

It’s no secret that learning programming is – at least for some of us – an obstacle course. Personally, it took me years to grasp the skills to be a some-what good programmer. For the last 3 or 4 years I’ve been involved in teaching programming basics for freshmen in my university. I started with helping fellow students, then started as a mentor for department and nowadays in addition to previous, I work as a part-time teacher on our courses.

I’ve come to conclusion that one of the reasons for it being so difficult is, that one needs to learn a huge amount of different things at the same time for being able to move forward.

I think that there are three important subtopics that students need to learn at the same time: programming language syntax, what can be done with programming languages and problem-solving. For many students, it seems that they don’t really realize that there is more in the classes than just learning the syntax: most of our exercises and problems don’t arise from that need but from learning problem-solving. Too often do I hear the sentence “This has not been taught to us” while assisting students with their exercises. True, they have not been told the solution but they have been given all the tools to code but they need to come up with the solution themselves.

One of the hardest parts in teaching is to remain on the level of solving everything with basic structures: we often tend to know trick or two to easily solve the problem on a one-liner which once again raise the statement “but they haven’t taught us this”. I’ll take an example from our course and how it can be solved quite differently.

We use Java as teaching language, so bear with me.

The exercise is: “Given a string that contains a binary presentation of a number, calculate and print the 10-base value.”

This is of course a valid, quick and smart way of doing it. But I think we all can agree that it doesn’t really teach you anything – maybe besides finding the solution on Google. Well, let’s use a for loop:

Here, it seems like now it’s more like a rookie version. And this is what is often showed to students. “But we haven’t been taught to use Math library” and yes, they have not. At this point, we could argue if teaching reading the API and googling for what it has to offer is what we should teach at this point. But often it might be too early and here we are not just trying to solve a problem but also to practice basic structures. So usually at this point student finally gets bit sad to see that oh, even the more experienced coders can’t solve this. That’s because we often don’t need to go down to the lowest level of implementing the pow()-function.

So:

After implementing the power function ourself, we have reached a solution which is done with basic structures that have been taught. That is the difficulty of assisting and helping students: how to keep everything down to the very lowest level that they have been taught.

Another issue is what student really has to know and learn to be able to deal with situations like this. Remember that the students I’m talking about, are people who have very little programming experience. Basically 3-4 weeks of our Java course.

So students have to have a strong feel on basics. Ideally, they would have been tinkering around with programming for those weeks. Usually, the truth is closer to students having only done compulsory exercises. Luckily we have quite a lot of those exercises so they have done more than we used to couple of years ago. Next comes the tricky part. Student needs to start breaking the problem into smaller, computer-understandable pieces. For most, this is the most important and most difficult part.

Ability to break problems into smaller, computer-understandable pieces is something that obviously comes only with experience: once you know what is possible, you know how the problem needs to be formulated. And it is something, that cannot be directly taught. If we tell people direct approaches to solving problems, the exercises become insignificant. We can only point the way.

In the end of the day, it’s all about attitude towards learning that counts. If you have an open-minded approach and willingness to learn, you will learn to program, no questions asked. But for most of us, it won’t be easy and it will take time. But in the end, it’s worth it.

(For my students who reached the end, please do not be offended. I still love you and I still continue to help you every way possible.)

Advertisements

2 comments

  1. Matti Ahti

    One problem that I noticed last year when I was a rank beginner was a kind of lack of experimentation. If you can’t solve the problem at hand, you could try solving an easier, but related one first. So instead of converting binary string to digits, you could just count every ‘1’ in the string. Or just print the original string at first, so at least you have a sensible signature and a method body that doesn’t refuse to compile. Or write comments about what you’re doing and fill in code little by little.

    Another thing that I noticed was additude to compiler errors. Those who struggled appeared to think of them as hopeless mountains of bugs that couldn’t possibly all squashed by *them*. Those who did well just tried to fix one error at a time without worrying about the rest of them and didn’t disparage themselves in the process.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s