Computer Programming: Chapter: 01 – Introduction


Before you jump in and start learning a programming language, it will be helpful to you if you understand what is programming and how it works, including some programming terminology.

A computer on its own is just a useless box. It’s nothing but a bunch of different hardware items assembled into a single unit. At this point, these hardware items either together or individually are of no use. This is as good as a Car that has been assembled. Is the car of any use without fuel? In the same way, we need to provide the computer with fuel, in this case its electricity (though there existed some types of mechanical computers, here we are referring to electrical machines). A computer at this point is essentially just a big bunch of tiny electronic switches that are either on or off. Now this is as good as a Car with enough fuel and can be driven, but no driver to drive.

We need a driver, who can operate the steering wheel, gears, breaks, etc., which will make the car move around. In the same way by setting different combinations of these switches, you can make the computer do something, for example, play a video on the screen or play a music video through the computer speakers or open a file, etc. Now telling a computer when to switch on these switches and when to switch off them is in other words nothing but instructing a computer what to do. This is what Programming is in very simple words.

Programming often refers to computer programming. So this now brings to our first and important question!

What is Programming?

Computer programming commonly known as programming or coding is the art of making a computer do what you want it to do. Programming in very simple terms is about writing programs. A sequence of instructions written to perform a specified task for a computer is known commonly as a Program, but is also referred to as a Software Program or even Computer Program. A computer being just hardware requires instructions to act upon. These instructions are executed in the computes CPU.

Programming is planning how to solve a problem. No matter what method is used — pencil & paper, slide rule, adding machine, or a computer — problem solving requires planning.

Based on the above definition, Programming is planning how to solve a problem. So here we are not actually solving the problem, but the computer will do it for us. If we solve the problem ourselves, then there is no necessity to write a program and hence, we don’t require a computer isn’t it.

Then why do we need a computer, simply because we know how to solve a problem and also know to instruct a computer to do it for us, but cannot do it at the speed & accuracy with which a computer can do it. Also we get Tired & Bored of doing the same job again and again, but the computer can do the same job a zillion times at the same speed & accuracy as the first one without getting bored or tired.

We can take a simple example of calculating the Sum of all even numbers from 1 to 1,000,000. This is not something that we cannot do, but the time that is required to calculate, the possibility of making a mistake at some point of time, amount of resources required if we use a pen and a paper or a calculating machine, and other similar reasons make this an undesirable option. Over & above this, what if we need to calculate between different set of numbers again and again? It is difficult humanly. But by writing a program, we can achieve this in less than 5 minutes. At the same time we can keep running the same program again and again for doing any number of calculations and also we can get accurate results in seconds.

I can instruct the computer to take each number, Add it with the next and from there on Add every next number to the previous sum till we reach the upper limit specified. Don’t look at these instructions for its accuracy, but what you need to understand here is that, I can instruct a computer to solve a problem only if I know how to do it. This means that unless I know the solution to the problem, it’s of no use even to try solving one.

You can take an example of a Cab driver on the street, but who is new to the city. With this cab driver, we cannot simple get into the car and ask him to drive to Point A. We will have to give him proper instructions on the route that he needs to take to reach the destination. I can give him the instructions on the route only if I know how. Otherwise, it will be a futile effort.

In the same way there is no point even trying to write a program until you have the knowledge of how you are going to set about solving the problem.

Put in simple words, Programming is telling a computer what to do. Though it seems to be pretty simple, it’s very complicated. You will have to keep in mind about two things here:

The very important point here is that Computers don’t speak English. Since a Computer being a machine only understands two basic concepts: on and off. The on and off concept is called binary system with on representing 1 and off representing 0. Hence Computer knows only one language that is of 0’s and 1’s commonly known as binary language.

The second important thing is that your instructions should be PRECISE. As I have mentioned previously, a computer on its own is just a useless box. It’s nothing but a bunch of different hardware items assembled into one unit.

So if you have to instruct a computer, then you have to tell them PRECISELY what to do.

Now I hope you have got to know the complexity in Programming.