Monday, August 8, 2011

Introduction to Programming

Introduction to Programming :
 Program :
A program is a set of instructions which are grouped together to perform a particular task.
Programming :
Programming is instructing a computer to do some task with the help of a programming language.
Programming Language :
A programming language is used to write programs. They are defined by syntactic and semantic rules which describe their structure. For example C, C++, JAVA. Normally programming languages refers to high level programming languages.
Paradigms of programming languages :
The Paradigms of programming Language gives the model to the programmer to write the programs.The different Paradigms of programming languages are
  1. Unstructed Programming (or) Monolithic Programming

  2. Procedural Programming

  3. Structural Programming

  4. Object Oriented Programming

Monolithic Programming :
  • In this whole problem is solved as a single block.

  • All the data are global and there is no security.

  • To share the codes jumps are allowed and so contain lot of go to statements.

  • This is suitable only for small problem.

  • Difficult to follow and correct errors

                         Eg, Assembly Language, BASIC.
Procedural Programming :
  • The given problem is divided in to a number of sub problems depending upon its functionality.

  • The sub problems are called procedures or Methods.

  • Any procedure can be called at any point during the program execution.

  • The program has global and local variables.

  • Global variables can be only be used

Features of procedure oriented Programming :
  1. Large Programs are divided in to small function or Procedure.

  2. Uses Top-Down programming Approach.

  3. Data moves freely from one function to another.

  4. Most of the functions share common data.

  5. Emphasis is given for algorithms.

Disadvantages :
  1. Very difficult identify which data is used by which function.

  2. Error Correction is difficult.

Structural Programming :
  • The program is divided into modules and the modules are then divided into functions.

  • The usage of goto statement is removed or reduced.

  • Each module can work independent of one another.

               Example: ADA, C++.

Object Oriented Programming :
  • The Program is divided into number of small units called Object. The data and function are build around these objects.

  • The data of the objects can be accessed only by the functions associated with that object.

  • The functions of one object can access the functions of other object.