unit 3 : programming paradigm – kishore k

A programming paradigm is a fundamental style of computer programming. There are four main paradigms: object-oriented, imperative, functional and logic programming.

Pragramming paradigm’s foundations are distinct models of computation: Turing machine for object-oriented and imperative programming, lambda calculus for functional programming, and first order logic for logic programming.

Object-oriented programming (OOP) is a programming paradigm that represents concepts as “objects” that have data fields and associated procedures known as methods. Objects, which are instances of classes, are used to interact with one another to design applications and computer programs.

» Imperative : Machine-model based
» Functional : Equations; Expression Evaluation
» Logical : First-order Logic Deduction
» Object-Oriented : Programming with Data Types
• Classification:


Imperative paradigms
• It is based on commands that update variables in storage. The Latin word imperare means “to command”.
• The language provides statements, such as assignment statements, which explicitly change the state of the memory of the computer.
• This model closely matches the actual executions of computer and usually has high execution efficiency
• Many people also find the imperative paradigm to be a more natural way of expressing themselves.

Functional programming paradigms
• In this paradigm we express computations as the evaluation of mathematical functions.
• Functional programming paradigms treat values as single entities. Unlike variables, values are
never modified. Instead, values are transformed into new values.
• Computations of functional languages are performed largely through applying functions to
values, i.e., (+ 4 5).

Logic programming paradigms
• In this paradigm we express computation in exclusively in terms of mathematical logic.
• While the functional paradigm emphasizes the idea of a mathematical function, the logic paradigm
focuses on predicate logic, in which the basic concept is a relation.
• Logic languages are useful for expressing problems where it is not obvious what the functions should
• For example consider the uncle relationship: a given person can have many uncles, and another person can be uncle to many nieces and nephews.
• Let us consider now how we can define the brother relation in terms of simpler relations and properties father, mother, and male. Using the Prolog logic language one can say:
brother(X,Y) /* X is the brother of Y */
/* if there are two people F and M for which*/
father(F,X), /* F is the father of X */
father(F,Y), /* and F is the father of Y */
mother(M,X), /* and M is the mother of X */
mother(M,Y), /* and M is the mother of Y */
male(X). /* and X is male */

The Object-Oriented Paradigm
• OO programming paradigm is not just a few new features added to a programming language, but it a new way of thinking about the process of decomposing problems and developing programming solutions
• Alan Kay characterized the fundamental of OOP as follows:
• Everything is modeled as object
• Computation is performed by message passing: objects communicate with one another via message passing.
• Every object is an instance of a class where a class represents a grouping of
similar objects.
• Inheritance: defines the relationships between classes.
• The Object Oriented paradigm focuses on the objects that a program is representing, and on
allowing them to exhibit “behavior”.
• Unlike imperative paradigm, where data are passive and procedures are active, in the O-O
paradigm data is combined with procedures to give objects, which are thereby rendered

A multi-paradigm programming language is a programming language that supports more than one programming paradigm. As Leda designer Timothy Budd puts it: “The idea of a multiparadigm language is to provide a framework in which programmers can work in a variety of styles, freely intermixing constructs from different paradigms.” The design goal of such languages is to allow programmers to use the best tool for a job, admitting that no one paradigm solves all problems in the easiest or most efficient way.

One example is C#, which includes imperative and object-oriented paradigms as well as some support for functional programming through type inference, anonymous functions and Language Integrated Query. Some other ones are F# and Scala, which provides similar functionality to C# but also includes full support for functional programming. Perhaps the most extreme example is Oz, which has subsets that are logic, a functional, an object-oriented, a dataflow concurrent, and other language paradigms.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: