I have taught a very large number of students programming for about 30 years. Roughly about 20% of each set of students end up being good programmers, while many others do not learn programming all that well. One of the common questions I am asked to answer is “Is there a recipe for learning programming well?”
Yes, there is, and yes, there are! That is, many people have advocated several methods of learning programming effectively. You might be thinking that I am referring to “programming through stepwise refinement” or “structured programming” and all that. While they are all useful, I am not referring to any of these. A simple recipe for learning programming effectively is to “learn by doing”.
You cannot learn to ride a bicycle by reading a book, or listening to a wonderful set of lectures, watching a video or anything else. The only way you effectively learn to ride a bicycle is to “practice riding the bicycle”. We have all learned bicycling only by attempting to ride it, falling off, hurting ourselves and finally experiencing the thrill of riding the bicycle in a well-balanced manner. We multitask by taking in the scenes around us, we talk to our friends, we listen to music on our iPods, and so on. Hey, do I hear someone saying “Who rides a bicycle anyway?” Thousands of people do it in Netherlands, even in large cities like Amsterdam. Thousands of students do this in a little town called Pilani in Rajasthan where I had the privilege of teaching students for more than 20 years. Clearly, I miss bicycling in Bangalore. I guess I am not brave enough!
But we are not talking about bicycling. Learning programming effectively means that, like bicycling, you must learn by doing. So what should I be doing to learn by doing? Too many students depend too much on learning programming in classes (through lectures), or by reading books, or by learning them through videos. That is not the “doing” that I mean. You must learn by solving many problems by writing programs, and getting them executed correctly on a computer.
It is not enough that you write the algorithms, but not the program. It is not enough that you write the program, but do not get it compiled and tested. You must execute the program and test it with suitable test data to convince yourself (and anyone else) that the program works as intended. So, how many problems must I solve to gain a significant competency in programming? There is no scientific basis in my recommendation. But it has worked well with many of my students. Solve at least one simple problem and another one problem of a medium level of difficulty every day. Well, alright, you may skip one day in the week as a relaxation! And once every month, I recommend trying to solve one problem that is somewhat challenging.
Where do you find these problems? There are several places, actually. You can find them in books. You can find them in possibly in your college library (collection of assignments, question papers, etc.). Well, don’t blame me if your college assesses students of programming through questions such as “Write short notes on (a) recursion, (b) passing parameters by reference, etc.” That is pathetic, but how does one advise and transform custodians of teaching and assessment? Of course, you can find several thousands of programming problems on the Internet.
I believe that you can find sufficient numbers of problems from these sources to learn by doing. I will, in my future postings, share some fabulous places where you can find programming problems.
So, start now! Learn by doing! It would be useful if you can also share your experiences on learning by doing with others through this site.