Topic_01 :

What is Programming?

A boring introduction to software

1)You can
go to the next topicif you know  the computer basics.

2)The next topic in this page starts after the next horizontal line.

    Software is an interface between us and the computer.  We write software to solve certain problems.(That problem could be any thing like differential equation or climate estimation or online business deals or national security or diverting the meteors that may fall on earth )

    Suppose that you are training a dog.  The first lesson you teach your dog is to greet people by raising it's fore leg (It is considered to be the dog's style of saying "Hello").

    We want the computer to do some work for us.  So, we will start with assigning simple tasks to the computer like saying "Hello".  Later, we will ask the computer to do more complex things.

    Now, coming back to our dog example, If we say "Hey dog! say hello", the dog may not do anything, because it can't understand our language.  We should tell in such a language that it understands(Dog trainers know this Dog's language well).

    Exactly the same thing happens to computers.  If we simply say "Hello computer!" the computer won't reply you. (If you are familiar with speech interface, ignore this statement).  We should talk with the computer in such a language that it can understand it.

That's why, we write  software in the languages like C, VC++ etc.

1) Basically, programs happen to be a textual collection of statements we write in those languages. 

2) Software means programs and their reference manuals

3) Compilers convert that programs into computer readable form (also called as binary form or machine language, which consists of just zeros and ones).  Click here to read more about compilers and interpreters.

The process of writing programs for making the computers to do our work is called as programming.

A little explanation, before you learn your first program.

Through programs, we can do two kinds of things.

1) We can teach the computer, how to do a work.

2) We can tell the computer what to do.

This kind of things are called as "Instructions".  These can be compared with statements in English.

A group of instructions is called as a "Function".  A function can be compared with a paragraph in English.

A group of functions is called as a "Program".  A program can be compared with a document in English.

fact a program can have many other things which are intensionally skipped in this tutorial.


Our first computer program

With this background, let us start our journey with a simple "Hello World" program. 
Q) Why "Hello World!" program?
A) Refer the dog example above.

The method we follow here is, The program will be presented before you first.  Later, it will be explained, part by part.

1) Watch the computer program

2) Understand the program

Our first computer program looks like this...

# include <Stdio.h>

void main()
    printf("Hello World");

Explanation on the program:

Before we ask the computer, to do some task, we should do some additional work.  Computer can learn many things.  We should request the computer that, we need a small part of those things.  This was done by the first line in the program,

1) # include <Stdio.h>

"Stdio.h" stands for standard Input and Output header file.  What ever the computer has learnt, it will be declared in the header files ( files with .h extension ).  Computer know, how to display text.  Some one taught the computer to display text, by writing a function, named as "printf".  It is declared in stdio.h file.

Now, we use that printf function to display the text "Hello World".  So, to use that function, we write our own function, named as "main".  The statements in a function are enclosed by curly braces.

2) void main()
So far fine.  Bur you see some weird word "void" and also brackets after the word "main".  They too has got some meaning.

Functions in programs could be of two kinds


In this case, the function, named "main" happens to be of the second type.  We tell to the computer that, it is of second type by adding the word "void" before it.

There is also a pair of brackets, which is empty.  In computer programming, there could be a function, that don't require any values to do it's work.  So is our "main" function. That's why there are no elements in between the brackets.

a) A program can have many functions.  Computer starts its work from the function, named "main"

b) C language is case sensitive.  While you type the program, watch the case.

3) {
This opening curly brace says that, the function is starting here

4) printf("Hello World!");

In the next line, we ask the computer, to show the text, "Hello World".
You can notice two punctuation symbols in that line. " and ;

Everything you write in quotes ( between " and " ) will be displayed as it is on the screen by the printf function.

In the end you can watch the semicolon.  It is same as a full-stop in English language.  In C language, statements end with a semicolon.

5) }
This ending curly brace says that, the function ends here

This ends the very first theory tutorial on computer programming.

Next, u'll learn, how to do it practically on a computer.  Click here for the next class