Lec2-Programming-Paradigms
Lec2-Programming-Paradigms
PARADIGMS
ITP 224: INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 1
LECTURE 2
ELMER H. FESTIJO – INSTRUCTOR 1
WHAT IS A PROGRAMMING PARADIGM?
Example:
GLOBAL VARIABLE:
A global variable is a
variable with global
scope. Scope refers to
the visibility of
variables. By global
scope, it means the
variable is visible and
accessible throughout
the program.
DECLARATIVE PARADIGM
Declarative paradigm is a non-imperative
style of programming. In the declarative
programming paradigm, we only tell the
computer what the problem is and let the
system decide what steps to take and also
the sequence of those steps.
Imperative says how to do it, and declarative
says what to do.
DECLARATIVE PARADIGM
1. Structured Paradigm
2. Procedural Paradigm
3. Object-Oriented Paradigm
STRUCTURED PROGRAMMING:
Structured programming is a programming
paradigm that uses structured control f low to
improve code clarity and quality.
Three ways of com b i ni ng p rog ram s -
sequencing, selection, and iteration.
STRUCTURED PROGRAMMING:
ADVANTAGES OF STRUCTURED
PROGRAMMING:
The code is well organized.
We can execute a block of code repeatedly
till the given conditions match.
Improved decision making power. Based on
some conditions, we can decide to execute or
not any block of code.
The structured f lo w of execution using
if/else and for/while.
PROCEDURAL PROGRAMMING:
A procedural programming paradigm is
derived from structured programming. It is
based on the concept of the procedure call.
Procedures are also known as routines,
subroutines, methods, or functions.
A Procedure contains a series of
instructions coupled together.
PROCEDURAL PROGRAMMING:
PROCEDURAL PROGRAMMING:
Examples of procedural languages are C,
C + + , J a v a , K o t l i n , P H P, e t c . a s t h e s e
languages suppor t functions, methods,
procedures.
PROCEDURAL PROGRAMMING:
Advantages:
The code becomes reusable.
Writing modular code is possible; this
gave birth to another paradigm that is
Modular Programming.
It is easier to keep track of the control
flow.
OBJECT-ORIENTED PROGRAMMING:
An object-oriented programming paradigm
is based on the concept of objects. An object
can be any real-world entity. An object has
data(properties, variables) and behaviour
(methods).
Object-Oriented paradigm took
programming to the next level by supporting
features like abstraction, encapsulation,
inheritance, polymorphism.
CLASS-BASED:
In class-based
languages, the
classes are def ined
beforehand, and the
ob j ec ts a r e
instantiated based
In c la s s - b a s ed la ng u a g es , o b j ec t s a re
on the classes.
instances of classes. Java supports class-
based programming.
PROTOTYPE-BASED: