Monday, November 9, 2009

Is There a Recipe for Learning Programming Effectively?

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. Many others do not learn programming that effectively. One of the common questions I am asked to answer is “Is there a recipe for learning programming well?”

Yes, there is! Many people have advocated several methods of learning programming effectively. You might be thinking that I am referring to “structured programming”, “stepwise refinement”, etc. While they are all useful, I am not referring to any of these as an effective recipe. 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.

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? 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? 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. There is no rigorous scientific basis in my recommendation. But it has worked well with many of my students.

Where do you find these problems? There are several places, actually. You can find them in books. You can find them 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.

2 comments:

  1. Can programming skills be taught to just about anybody?

    ReplyDelete
  2. Dear Ravi

    I really have no scientific data to answer this. My feeling is that it cannot be taught to just about anybody. One of the important requirements for learning programming is that the person must be capable of logical thinking. To "learn by doinG" the person must have not only the abilities, but the discipline to learn. I have seen many persons who do not have these qualities.

    Computer programming os not important to be ealrnt by everyone. But learning to use computers in whatever endeavor the person is engaged in may be more important.

    ReplyDelete