Sundarrajk's Weblog

Archive for the ‘Programming Paradigms’ Category

Object Oriented Programming

The major Programming Paradigm in today’s programming world is Object Oriented Programming. In this a Program consists of Objects. One writes a Class and when the Class is instantiated it results in an Object. The class is the Abstraction of Objects that will exist in the Program.
Objects have Attributes which can be set to represent different concrete Objects.
Objects have Methods which can be invoked to change the status of the Object or to make the Object do something.

class Person {
   /* Attributes */
   String name;
   int age;
   char gender;
  /* Methods */
is a class. It is a definition of the class Person. This can be used to represent different people with different attributes.
MsJane = new Person();
MrJohn = new Person(); = “Ms. Jane”;
Person.age = “52”;
Person.gender = “F”; = “Mr. John”;
Person.age = “25”;
Person.gender = “M”;


In the above example MsJane and MrJohn are instances of the class Person. They are “Objects” that will come into being when somebody runs the programs and they will die once he Program stops.

The Class Person continues to exist.

Most common Object Oriented Programming Languages are:

  • C++
  • Java
  • SmallTalk

Procedural Programming
Procedure Programming is a paradigm where programs contains Procedures. Procedures are pieces of code which does some work. The Program itself is a series of invocation of Procedures.
The Procedure itself is a set of instructions telling the computer what to do. See (
Procedures are also called as Subroutines or Functions.

Most common Procedural Programming Languages are:

  • C

Functional Programming
Functional Programming as the name indicates consists of a set of Functions that does something. This may be easily confused with Procedural Programming as the code pieces are also called functions. But there are major differences between Functional Programming and Procedural Programming, the main ones being
1. Variables can be assigned different values in Procedural Programming. In Functional Programming a variable is assigned a value only at the time of declaration. The value of the variable never changes.
2. Global variables are common in the Procedural Programming Paradigm. There are no global variables in Functional Programming Paradigm.
3. There are no Lambda functions in Procedural Programming Paradigm. Functional Programming Paradigm is all about Pure Functions. Functions can be passed around and that is the Key, “Passing Functions around” as if they were variables.
4. Procedural Programming is all about manipulating variables and creating side effects. Functional Programming Paradigm entails no Side Effects.

Most common Functional Programming Languages are:

  • Lisp
  • Scala
  • F#

Logical Programming Paradigm
This is basically a Paradigm where solutions to problems are determined. It is used in Mathematical programming and it applies different rules to arrive at a solution.
Most common Logical Programming Languages are:

  • Prolog

See for some more details.