How to improve programming skills

Few years ago, a student told me: “I hate coding.” This may sound very negative to any professor who teaches programming but actually it is just an expression of a frustrated student who does not have sufficient programming skills yet. Only when they gain enough experience and understand what is wrong and what is right with their own work, they will be able to write code better. The important thing to do is to eliminate the fear of programming and improve students' confidence in their ability to write codes. Here is a simple technique that I have used in my classes.

At the beginning of the course, I tell students that the first three programs will not be graded. It means they can make mistakes and it does not matter whether their programs are running or not. It reduces the stress students feel about taking computer programming class. What I want from them is just write code and experiment the coding process by themselves. Although these programs are not graded but they must turn in for the purpose of identifying mistakes that they make so I can correct them in class and explain why their programs do not work.

In the next three programs, instead of correcting their mistakes, I show the class sample programs on the black board and ask students to correct their own mistakes. They review their own program, line by line to identify their own mistakes. After that I review their programs then discuss about common problems often found in their programs. In the first program, most students are able to correct their own syntax, some are able to find mistake in their own logic but at the second and third programs, most can identify all problems that they have made and begin to understand why their programs do not work. In other word, they learn from their own mistakes. By this time, I also let the class know that those programs will not be graded to release their stress but I tell them from now on, if they still make the same mistakes again in their program, it will be graded and added to the final grade.

As the class continues, most students learn how to recognize their own mistakes and be able to fix them. Over time, few are making mistakes and they become less frustrated as their programming skills improve. At this time, most students gain confidence in their ability to write code then I let students review each other's program to correct them as they learn more about structure and logic from other's views. Most students understand that by reviewing their classmates' programs, they can improve their own coding skills.

When students feel comfortable about programming, I continue to build their confidence by giving a “Mini-hackathon” exercise each week where they are required to write a small program (approximately 100 to 250 line of code) within half an hour. Whoever finishes first with correct results will get extra bonus points. This type of competition encourages them to develop better programming skills as they must code quickly within a fix time. I can watch how students go through as they work to accomplish this challenge. Some seem uncomfortable that they may not be able to finish in the time allotted, but their doubts quickly change as they focus less on the time and more on the result. The happiest students are the ones who thought they could never do it, but find a way to complete the challenge. After about five or six weeks, most students tell me that writing code has become as natural as they write in English as they do not even think much about syntax or rules anymore. One happy student explains: “Now I know what learning by doing means. First I learn to do it then I learn what works and what does not works then I learn to do it right by apply the rule then how the rule can be modified and generalized. Suddenly it become part of our thinking and our coding ability.”

I have very good success with this technique in all my programming classes, regardless whether it is Java or C++ or Python. When students do not feel stress by grade or failure, they will focus more on learning. When students are given the chance to learn from their own mistakes, they will learn well. When students are given more chance to practice, they will develop their skills. When they have the skills, they will feel better about themselves, and gaining confidence about their ability. Learning by doing is about giving them the opportunity to learn by themselves but of course, they do need support and guidance from teachers.

Sources

  • Blogs of Prof. John Vu, Carnegie Mellon University

You may like