G4 Chapter 3 2019
G4 Chapter 3 2019
Programming Paradigms
Prof DP Sharma
http://dpsharma.info
Course Outline
Programming Paradigms-
Introduction to Machine
Procedural,
Object Oriented.
New Paradigms like-
Logic Programming,
Knowledge based Programming
and
Symbolic Programming etc.
Definitions
In science and philosophy, a paradigm is a
distinct set of concepts or thought patterns,
including theories, research methods, postulates,
and standards for what constitutes legitimate
contributions to a field.
What is Programming Paradigm?
programming “technique” (?)
way of thinking about programming
view of a program
Programming Language
consists of words, symbols, and rules for
writing a program
Paradigm?
Thomas Kuhn (The Structure of Scientific
Revolutions): "… accepted samples of
practical methods in science.”
Willis Hartman (An Incomplete Guide to
the Future): "… a basic way of
perceiving, thinking, valuing and
doing things that are associated with a
particular vision of reality.”
Marilyn Ferguson (The Aquarian
Conspiracy): "… a framework for
thought… a scheme for understanding
and explaining certain aspects of reality."
Definition of programming
paradigm
“A programming paradigm is a
fundamental smartness or
style of computer programming,
that leads as a new style of building
computer programs. “ Definition by
Prof. DP Sharma http://dpsharma.info
Capabilities and styles of
various programming languages are
influenced by one paradigm or more
than one paradigms.
The Paradigm Shift ?
A paradigm shift, as identified by
American physicist Thomas Kuhn, is a
fundamental change in the basic
concepts and experimental practices of
a scientific discipline. (Source: WIKI)
A Paradigm Shift as a change from one
way of thinking to another. It's a
revolution, a transformation, a sort of
metamorphosis. It just does not
happen, but rather it is driven by
agents of change.
The Paradigm Shift (cont’d)
Examples (specific to computing):
• Structured programming. Example C, Pascal
• Object oriented programming. Example C++,
Java
• The WWW.
• The .Com boom
• Computing in Astronomy.
• Cloud Computing
• IoT
NOTES:
• Paradigm shifts occur suddenly.
• Their timing is VERY difficult to predict.
Contd…
Imperative paradigm- First do
this and next
Functional paradigm - do that
Evaluate an
expression and use
the resulting value
for something
Logic paradigm- Answer a
question via
search for a
Up to this day, functional programming has not been very popular except
for a restricted number of application areas, such as artificial
intelligence.
John Backus presented the FP programming language in his 1977 Turing
Award lecture "Can Programming Be Liberated From the von Neumann
Style? A Functional Style and its Algebra of Programs".
Widespread declarative domain-specific languages like SQL and
Lex/Yacc, use some elements of functional programming, especially in
eschewing mutable values. Spreadsheets can also be viewed as
functional programming languages.11
Logic paradigm
The logic paradigm is dramatically
different from the other three main
programming paradigms.
The logic paradigm fits extremely well
when applied in problem domains
that deal with the extraction of
knowledge from basic facts and
relations
Object Oriented paradigm
The primary and most direct reason is
undoubtedly the strong support of
encapsulation and the logical
grouping of program aspects.
These properties are very important
when programs become larger and
larger
Object-oriented
programming
Later, object-oriented languages
(like Simula, Smalltalk, C++, C#, Eiffel and
Java) were created.
In these languages, data, and methods of
manipulating the data, are kept as a single
unit called an object.
The only way that a user can access the
data is via the object's "methods"
(subroutines).
Because of this, the internal workings of an
object may be changed without affecting
any code that uses the object.
[Independence]
Contd..
• May include features such as data
abstraction, encapsulation,
modularity, polymorphism, and
inheritance.
• Simula language in 1965, and
• Smalltalk in the 1970s, developed
• Many modern programming
languages now support OOP.
Contd..
There is still some controversy by
notable programmers such as
Alexander Stepanov, Richard Stallman
and others, concerning the efficacy of
the OOP paradigm versus the
procedural paradigm.
Polymorphism was developed as one
attempt to resolve this dilemma.
Since object-oriented programming
is considered a paradigm, not a
language, it is possible to create even
an object-oriented assembler language.
Contd…
Other Programming paradigms
that are often distinguished include
Machine paradigm
Processing paradigm
Declarative paradigm
Procedural paradigm
Knowledge Based paradigm and
Symbolic programming based
paradigm
Lowest Paradigm- Machine
Machine code
The lowest level programming
paradigms are machine code, which
directly represents the instructions
(the contents of program memory) as
a sequence of numbers, and
assembly language where the
machine instructions are represented
by mnemonics
These are sometimes called first- and
second-generation languages.
Contd..
In the 1960s, assembly languages
were developed to support library
COPY
Assembly was, and still is, used for
time critical systems and frequently
in embedded systems as it gives the
most direct control of what the
machine actually does.
Processing Paradigms
• A programming paradigm can be
understood as an abstraction of a
computer system, who is based on a
certain processing model or paradigm.
1950s to 1960s
FORTRAN, COBOL, LISP, BASIC
1960s to 1970s
(ALGOL-based) Pascal and others
1970s to 1980s
Prolog, C, Ada
1980s to 1990s
C++, ML, Perl, Java
Knowledge-Based Programming...
Designed for the New generation of
programmers, the Wolfram Language
has a vast depth of built-in algorithms and
knowledge, all automatically accessible
through its elegant unified symbolic
language.
Scalable for programs from tiny to
huge, with immediate deployment
locally and in the cloud,
the Wolfram Language builds on clear
principles—and 25+ years of development
—to create what promises to be the world's
most productive programming language.
Knowledge-based programming: Wolfram releases
first demo of new language, 30 years in the making
End