Friday, 11 April 2014

PROGRAMMING - Overview

I assume today is your first day when you heard about computer programming. You are curious to know what exactly is computer programming? Before you understand what is computer programming, you need to understand what is computer program?
I'm making an assumption that you know a little about what is computer and how to use it for Internet browsing, Exploring Facebook or Checking e-mail using Gmail, etc.

What is Computer Program?

A computer program is a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer
I assume, you did not understand what I have written about computer program but let’s see two important terms, which I have used in the above definition:
  • Sequence of instructions
  • Computer Programming Language
To understand these terms, consider a situation when someone asks you about how to go to a nearby KFC. What exactly do you do to tell him the way to go to KFC?
You will use Human Language to tell the way to go to KFC something as follows:
First go straight, after half kilometer, take left from the red light and then drive around one kilometer and you will find KFC at the right.
Here, you have used English Language to give several steps to be taken to reach to KFC. If they will be followed in the following sequence, then you will reach KFC:
1. Go straight
2. Drive half kilometer
3. Take left
4. Drive around one kilometer
5. Search for KFC at your right side
Now, try to map the situation with computer program. Above sequence of instructions is actually a Human Program written in English Language, which instructs on how to reach to KFC from a given starting point. This same sequence could have been given in Spanish Language, Hindi Language, Arabic or any other human language provided someone, who is asking about the way, knows about such languages.
Now, let's go back and try to understand about a computer program, which is a sequence of instructions written in a Computer Language to perform a specified task by the computer. Following is a simple program written in Python programming Language:
print "Hello, World!"
Above computer program instructs computer to print "Hello, World!" on computer screen.
  • A computer program is also called a computer software, which can range from two lines to millions of lines of instructions.
  • Computer program instructions are also called program source code and computer programming is also called program coding.
  • A computer machine without a computer program is just a dump box and thus computer program brings a computer machine to live state.
Like human has several languages to communicate their message, computer scientists have developed several computer-programming languages to provide instructions to the computer (i.e., to write computer programs). We will see several computer programming languages in subsequent chapters.

What is Computer Programming?

If you understood what is computer program, then I will say the act of writing computer programs is called computer programming.
As I mentioned earlier, there are 100s of programming languages, which can be used to write computer programs and following are few of them:
  • Java
  • C
  • C++
  • Python
  • PHP
  • Perl
  • Ruby

What Computer Program can do?

Today computer programs are being used in almost every field, household, agriculture, medical, entertainment, defense, communication, etc. Following are few applications of computer programs:
  • MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are example of computer programs.
  • Computer programs are being used to develop graphics and special effects in movie making.
  • Computer programs are being used to perform Ultrasounds, X-Rays, and other medical examinations.
  • Computer programs are being used in our mobile phones for SMS, Chat, and voice communication.

Who is Computer Programmer?

If you understood what is computer program and what is computer programming, then simply apply common sense to understand who is computer programmer?
Someone, who can write computer programs or in other words, someone who can do computer programming is called Computer Programmer
Based on computer programming language expertise, we can name computer programmers as follows:
  • C Programmer
  • C++ Programmer
  • Java Programmer
  • Python Programmer
  • PHP Programmer
  • Perl Programmer
  • Ruby Programmer

What is Algorithm?

From programming point of view, an algorithm is a step-by-step procedure to resolve any problem. An algorithm is an effective method expressed as a finite set of well-defined instructions.
Thus, a computer programmer lists down all the steps required to resolve a problem before jumping to write actual code. Following is a simple example of an algorithm to find out a largest number from a given list of numbers:
1.      Get a list of numbers L1, L2, L3....LN
2.      Assume L1 is the largest,  Largest = L1
3. Take next number Li from the list and do the following
4.      If Largest is less than Li
5.         Largest = Li
6.      If Li is last number from  the list then
7.         Print value stored in Largest and come out
8.      Else repeat same process starting from step 3
Above algorithm has been written in very crude way just because to make it clear to beginners, otherwise if you will study computer algorithm subject then you will find standardized way of writing computer algorithm.
 

Basics of programming

I assume you are well aware of English Language, which is a well-known Human Interface Language. English has a predefined grammar, which needs to be followed to write English statements in a correct way. Likewise, most of the Human Interface Languages (Hindi, English, Spanish, French, etc.) are made of several elements like verbs, nouns, adjectives, adverbs, propositions, and conjunctions, etc.
Similar to Human Interface Languages, Computer Programming Languages are also made of several elements. I will take you through the basics of those elements and put some effort to make you comfortable to use them in various programming languages. These basic elements are:
  • Programming Environment
  • Basic Syntax
  • Data Types
  • Variables
  • Keywords
  • Basic Operators
  • Decision Making
  • Loops
  • Numbers
  • Characters
  • Arrays
  • Strings
  • Functions
  • File I/O
I will explain all these elements in subsequent chapters with examples using different programming languages. First we will try to understand meaning of all these terms in general and then we will see how these terms can be used in different programming language.
I believe if you understood above-mentioned elements related to any programming language, then you are almost ready to write big enough programs in that programming language.
I designed this tutorial to give you an idea about the following most popular programming languages:
  • C Programming
  • Java Programming
  • Python Programming
Major part of the tutorial has been explained by taking C as programming language and then I tried to show how similar concepts work in Java and Python. So after completion of this tutorial, you will find yourself familiar with these popular programming languages.

No comments:

Post a Comment