Programming…Programming…Programming…

It is most essential and appropriate to understand what programming really means. Let us first see a widely known definition of programming.

“A program is a precise sequence of steps to solve a particular problem.”

 It means that when we say that we have a program, it actually mean that we know about a complete set activities to be performed in a particular order. The purpose of these activities is to solve a given problem. 

Alan Perlis, a professor at Yale University, says:

“It goes against the grain of modern education to teach children to program. What fun is there in making plans, acquiring discipline in organizing thoughts, devoting attention to detail and learning to be self-critical? ”

It is a sarcastic statement about modern education, and it means that the modern education is not developing critical skills like planning, organizing and paying attention to detail. 

Mr. Steve Summit puts it “At its most basic level, programming a computer simply means telling it what to do, and this vapid-sounding definition is not even a joke. There are no other truly fundamental aspects of computer programming; everything else we talk about will simply be the details of a particular, usually artificial, mechanism for telling a computer what to do. 

Sometimes these mechanisms are chosen because they have been found to be convenient for programmers (people) to use; other times they have been chosen because they’re easy for the computer to understand. The first hard thing about programming is to learn, become comfortable with, and accept these artificial mechanisms, whether they make “sense” to you or not. “ 

Why Programming is important

The question most of the people ask is why should we learn to program when there are so many application software and code generators available to do the task for us. Well the answer is as given by the Matthias Felleisen in the book ‘How to design programs’ “The answer consists of two parts. First, it is indeed true that traditional forms of programming are useful for just a few people. But, programming as we the authors understand it is useful for everyone: the administrative secretary who uses spreadsheets as well as the high-tech programmer. In other words, I have a broader notion of programming in mind than the traditional one. I will explain our notion in a moment. Second, I teach our idea of programming with a technology that is based on the principle of minimal intrusion. Hence, my notion of programming teaches problem analysis and problem-solving skills without imposing the overhead of traditional programming notations and tools.”Hence learning to program is important because it develops analytical and problem solving abilities. It is a creative activity and provides us a mean to express abstract ideas.

Thus programming is fun and is much more than a vocational skill. By designing programs, we learn many skills that are important for all professions.

These skills can be summarized as: 

o Critical reading

o Analytical thinking

o Creative synthesis

  Hence while programming one should 

o Paying attention to detail

o Think about the re-usability.

o Think about user interface

o Understand the fact the computers are stupid

o Comment the code liberally

 Paying attention to detail

In programming, the details matter. This is a very important skill. A good programmer always analyzes the problem statement very carefully and in detail. One should pay attention to all the aspects of the problem. One can’t be vague. One can’t describe his/her program 3/4th of the way, then say, “You know what I mean?”, and have the compiler figure out the rest. Furthermore you should pay attention to the calculations involved in the program, its flow, and most importantly, the logic of the program. Sometimes, a grammatically correct sentence does not make any sense. For example, here is a verse from poem “Through the Looking Glass” written by Lewis Carol: 

“Twas brillig, and the slithy toves

Did gyre and gimble in the wabe “

 The grammar is correct but there is no meaning. Similarly, the sentence, “Mr. ABC sleeps thirty hours every day”, is grammatically correct but it is illogical. So it may happen that a program is grammatically correct. It compiles and runs but produces incorrect or absurd results and does not solve the problem. It is very important to pay attention to the logic of the program. 

Think about the reusability

Whenever you are writing a program, always keep in mind that it could be reused at some other time. Also, try to write in a way that it can be used to solve some other related problem. A classic example of this is:

Suppose we have to calculate the area of a given circle. We know the area of a circle is (Pi * r2). Now we have written a program which calculates the area of a circle with given radius. At some later time we are given a problem to find out the area of a ring. The area of the ring can be  calculated by subtracting the area of outer circle from the area of the inner circle. Hence we can use the program that calculates the area of a circle to calculate the area of the ring.

 Think about Good user interface

As programmers, we assume that computer users know a lot of things, this is a big mistake. So never assume that the user of your program is computer literate. Always provide an easy to understand and easy to use interface that is self-explanatory. 

Understand the fact that computers are stupid

Computers are incredibly stupid. They do exactly what you tell them to do: no more, no less– unlike human beings. Computers can’t think by themselves. In this sense, they differ from human beings. For example, if someone asks, “What is the time?”, “Time please?” or just, “Time?” we understand anyway that he is asking the time but computer is different. Instructions to the computer should be explicitly stated. Computer will tell the time only if we ask it in the way we  have programmed it. When we’re programming, it helps to be able to “think” as stupidly as the computer does, so that we are in the right frame of mind for specifying everything in minute detail, and not assuming that the right thing will happen by itself.

 Comment the code liberally

Always comment the code liberally. The comment statements do not affect the performance of the program as these are ignored by the compiler and do not take any memory in the computer. Comments are used to explain the functioning of the programs. It helps the other programmers as well as the creator of the program to understand the code. 

Program design recipe

In order to design a program effectively and properly we must have a recipe to follow. In the book name ‘How to design programs’ by Matthias Felleisen and the co-worker, the idea of design recipe has been stated very elegantly as “Learning to design programs is like learning to play soccer. A player must learn to trap a ball, to dribble with a ball, to pass, and to shoot a ball. Once the player knows those basic skills, the next goals are to learn to play a position, to play certain strategies, to choose among feasible strategies, and, on occasion, to create variations of a strategy because none fits. “ The author then continue to say that:

“A programmer is also very much like an architect, a composers, or a writer. They are creative  people who start with ideas in their heads and blank pieces of paper. They conceive of an idea, form a mental outline, and refine it on paper until their writings reflect their mental image as much as possible. As they bring their ideas to paper, they employ basic drawing, writing, and  playing music to express certain style elements of a building, to describe a person’s character, or to formulate portions of a melody. They can practice their trade because they have honed their basic skills for a long time and can use them on an instinctive level.

Programmers also form outlines, translate them into first designs, and iteratively refine them until they truly match the initial idea. Indeed, the best programmers edit and rewrite their programs  many times until they meet certain aesthetic standards. And just like soccer players, architects, composers, or writers, programmers must practice the basic skills of their trade for a long time before they can be truly creative. Design recipes are the equivalent of soccer ball handling techniques, writing techniques, arrangements, and drawing skills. “

 Hence to design a program properly, we must:

o Analyze a problem statement, typically expressed as a word problem.

o Express its essence, abstractly and with examples.

o Formulate statements and comments in a precise language.

o Evaluate and revise the activities in light of checks and tests and

o Pay attention to detail.

 All of these are activities that are useful, not only for a programmer but also for a businessman, a lawyer, a journalist, a scientist, an engineer, and many others. wish you good luck for programming…

 

Advertisements

About Khuram Ali

Programming... Programming and Programming...!!!

Posted on March 19, 2013, in Programming and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: