Programming Paradigm Defined
Programming Paradigm Defined
Aware naman tayo sa mga programming languages, and that each programming
languages ay may different approach, they all come under the two primary
paradigms, imperative and declarative, which will be discussed in more detail
later.
Programming paradigms kasi comes in a variety of forms, diba sobrang dami and
because each one is unique, importante na makapili tayo ng pinaka suitable and
appropriate na paradigm. May mga paradigm kasi na yung approach nila is di
naman magdudulot ng maganda sa code mo so parang useless lang siya kasi di
naman na solve yung problem.
Kaya mas maganda na mag explore tayo ng different paradigms for us to know
and to understand kung anong paradigm yung mas better and makakatulong
satin sa pagcocode.
EXAMPLE
Imperative Programming is like your friend calling your father that tells her how
to fix your car step by step.
Declarative Programming is like asking your friend to fix your car. You don’t
care how to fix it, that’s up to her.
With imperative programming, you tell the compiler what you want to happen, step by step.
For example, let's start with this collection, and choose the odd numbers:
REFERENCE:
https://www.indicative.com/resource/programming-paradigm/
https://towardsdatascience.com/what-is-a-programming-paradigm-1259362673c2
https://stackoverflow.com/questions/1784664/what-is-the-difference-between-declarative-
and-imperative-paradigm-in-programmin
https://www.ionos.com/digitalguide/websites/web-development/declarative-programming/
imperative in which the programmer instructs the machine how to change its state,
If you mean why do we need more then ONE paradigm, its because of a few things ...
(1) Different paradigms are better or worse suited to different problems.
(2) Paradigms evolve and grow, generally becoming more capable in the process.
Each paradigm consists of certain structures, features, and opinions about how common
programming problems should be tackled.
The question of why are there many different programming paradigms is similar to why
are there many programming languages. Certain paradigms are better suited for certain
types of problems, so it makes sense to use different paradigms for different kinds of
projects.
Programming paradigms are not languages or tools. You can't "build" anything with a
paradigm. They're more like a set of ideals and guidelines that many people have agreed
on, followed, and expanded upon.
Paradigms are important because they define a programming language and how it works.
A great way to think about a paradigm is as a set of ideas that a programming language
can use to perform tasks in terms of machine-code at a much higher level. These different
approaches can be better in some cases, and worse in others.
imperative in which the programmer instructs the machine how to change its
state,
o procedural which groups instructions into procedures,
o object-oriented which groups instructions with the part of the state
they operate on,
declarative in which the programmer merely declares properties of the
desired result, but not how to compute it
o functional in which the desired result is declared as the value of a
series of function applications,
o logic in which the desired result is declared as the answer to a
question about a system of facts and rules,
o mathematical in which the desired result is declared as the solution
of an optimization problem
o reactive in which the desired result is declared with data streams
and the propagation of change