Writing a Program

Writing a program is basically figuring out a way to solve a problem. The best way to solve problems is to break it down into smaller and smaller parts. By solving each of the smaller parts you will eventually come up with a solution.

Once you have broken down the problem, take each part and analyze it and figure out how you are going to solve it. Once you come up with an idea you have write “pseudo code”. This essentially means that you write down something similar to code, but in plain English. For example, a very basic pseudo code to collect the names and telephone numbers of 100 persons will look somewhat like this:

Declare variables name, tpnum and counter;
Repeat the following 100 times;
Set the counter value to 0;
Print message asking for name;
Store user input in variable name;
Print message asking for telephone number;
Store user input in variable tpnum;
Increment the counter value by 1;
End the repeat if counter reaches 100

Although this may seem like a tedious task, it will make more sense with longer or complex code. Including this in your documentation will also help other programmers if they have to modify your code. Implementing the practice of writing pseudo code will help you become a better programmer as time goes by. The process of thinking it out and mapping out a problem will help you avoid a lot of stress, frustration and time wasting, because all you have to do is write code that corresponds to your pseudo code.

This entry was posted on Thursday, April 22nd, 2010 at 8:46 am and is filed under Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply