Learn programming faster by using practical problems

Programming is not rocket science. But, like many acquired skills, it does need your constant attention. One cannot learn a program, and apply it out-of-the-hat 5 years later. Even by not considering the advancement in techniques, programming does not stay imprinted long enough on a typical human brain. So, programming needs practice and constant application of solution to problems. And, that is also the best way to learn a new programming language.

A simple way to start with a new programming language that can make the whole process more enjoyable:

Get an overview about the language

Learn about the nature of problem that the language intends (or is primarily intended) to solve. This is the area you have to focus on for defining your problem as well, which is easier said than done.

While any program can boast a lot of creds in each and every aspect of life, select the area that was the original intent of the program. For example, file processing for Perl. We know that Perl is really good and fast for file handling, and I know that my daily work will appreciate a few shortcuts to make sense of files (monthly, if not on a daily basis)

Define the problem

Although very much a part and parcel of programming world, this is not something that every programmer takes time doing. Define the problem that you have in a concise way, outline the solution concepts specific to the language.

The problem I have can be “Get the time taken by every SQL statement from the application log”. I would need the processing really fast to digest megabytes of log file without memory issues, and get output that can be opened by Microsoft Excel software.

Outline solution methodologies

Outline the methodologies that can be used in the programming language that will not only solve the problem, but solve it effectively. In other programming languages this may involve creating programs that use class/sub-class, and applying at least 2-3 more OOP concepts.

In Perl, for example, I just take pledge to write comments so that I remember what exactly do I mean by a given RegEx or a bunch of statements. In addition I decide to use RegEx that can provide faster processing of files.

Start small, Develop on concepts

Do not accomplish everything set in the solution methodology or by the problem statement itself at one go. You will miss out on the smaller satisfaction milestones that act as morale boosters along the way.

Again in my example, I will not aim for a complex RegEx that will process blocks in one go, but rather aim to do all processing using very simple RegEx and complex routines. This is easier for me to relate with. But later, I extend the concepts and play around RegEx itself to see which way is faster and better.

Define new problems every two months

Once you have a hang of it, don’t hang up your boots and move on. If you have really chosen well, the programming language is sure to pull you out of irksome situations. The best way to stay in touch is to extend your previous problem or to define a new problem altogether. Doing this every two months is going to keep you alive in the language, but you also tend to be abreast of any new developments in the language.

In the unlikely scenario that you are not a great creator of problems, learn to rely on many “program by example” books out there. These books help define a real-life problem, and go about outlining the solutions step-by-step thoughout the book. This helps stay on the course and solve problems rather than through rote. The “bibles” and all other comprehensive books are invaluable as reference, don’t ever forget about them for a moment.

Remember to have fun

Coding is fun and “it is the way”. Have a blast thinking about new problems and your own inventions of solving the problems faster and more efficiently.

PS: I author a programming blog at techformist.com. Check it out if you are interested in web development.

comments powered by Disqus