How to learn computer programming?

I’ve seen lot of people asking questions on exactly what they should do to learn computer programming. Well, there is no single answer for this question as computer programming is more than just learning a programming language like C and Java. I have seen some people recommending books on C/C++ etc. while some people believe that books cannot teach computer programming. In this article, we will see how a person can learn computer programming.

As I have said before, computer programming is lot more than just learning a programming language. Learning a programming language is nothing but learning its syntax and the constructs provided by that particular language. It is like learning different words in English like ‘cat’ or ‘sky’. You cannot speak in English just by knowing different words and their meanings but you also need to focus on grammar. After learning grammar, you actually need to speak in English with other people to get comfortable with it. Learning computer programming is also quite similar.

To learn computer programming, you first need to select a language, which is easier to use and learn. The first computer language that I used was BASIC and then PASCAL. I have seen many people recommending Python these days and I agree with them. Anybody can learn python quickly. However, there are many other languages, which you can use to start with.

After selecting the language, spend some time and go through its syntax and example provided for each. At the same time, try out those examples on your computer to understand how each function or syntax behaves. Keep on practicing until you get comfortable with the language syntax and its use. Before moving on to next steps, make sure that you are very comfortable with the language.

By this time, you will know how to use a language. Keep in mind that knowing how to use a language does not mean that you know computer programming. Computer programming is a way to teach computer how to solve a particular problem. Before learning how to use your language for solving complex problem, you need to learn how to use the language to solve basic problems (like sorting, searching) and how to manage data (data structures).

There are many books available, that will provide you with basic algorithms and will teach you about data structures. Learn those concepts and try to implement them in your language. In this way, after solving lot of examples you will see that most of the problems are solved by using simple concepts. At this stage, you can say that you have learnt computer programming. But wait, that’s not an end. There are many different ways to solve a particular problem and only experience can teach you which one is the best. Therefore, you need to keep practicing.

Remember, that learning computer programming takes lot of time and effort. Its not something that could be learnt directly from books. Even after learning computer programming, you need to practice it regularly with different problems. There are many open source projects, which you will find on the net. You can learn more by looking at their source codes. You can also try to participate in the development so gain more experience.

So keep learning and practicing. That is the way to learn computer programming.

Handling loss of data access due to server downtime

On 28th and 29th of September 2007, P.C. College of Engineering had organized a technical event called ‘Blitzkrieg 2007‘. I was involved in creating the script to allow users to register themselves as participants for various competitions. This simple script had two responsibilities.

  • Registration of participants
  • Listing of all participants

The script was pretty simple and worked fine till the day of event. Organizers were able to view all participants who had registered for competitions. However, during the day of event (28th September 2007), organizers faced a problem that we had not at all considered. The hosting plan for Blitzkrieg website had provided them with small bandwidth. Due to this, the allocated bandwidth got over on the day of event and organizers were unable to view the site and get participant’s list.I had never experienced such a problem before. Was it possible for me to write a script in such a way to handle this situation? It was definitely not possible to increase the bandwidth using a PHP script, but yes, there was a trick that would have helped organizers to access the latest data.Before understanding this hacky solution, let’s understand what the actual script used to do:

  1. Display a registration form to the user
  2. Get the data provided by user and validate it
  3. If the data was valid, then store the data and send a mail to registered user (participant), informing him about successful registration.

Here, we would have added an extra step to send a mail to organizers after every successful registration with corresponding sql (insert or update sql). This would have given organizers a list of sql commands which if they could have executed on local database. This would have provided them with local access to list of participants even in case of bandwidth failure on central server.

This solution is just a precautionary measure to handle such kind of situations. It has to be implemented before the problem occurs. In our case, we had to call the customer support of our web-host who acted quickly and increased the bandwidth, allowing organizers to view the list of participants.