Programming Paradigm

Yash Yadav
2 min readJun 18, 2024

--

Defines the way code should be understood (written/read) by either :-

Program (machine)
Programmer

Photo by Emile Perron on Unsplash

Two of the Broad level category of such paradigms are :-
1. Imperative : Focused on how to do a thing.
2. Declarative : Focused on what to do.

Below are few examples of the programming paradigm, with some brief.
(Placing of them in one of the above mentioned two categories is been left out to the reader)

Structured Programming :-
forces us to recursively decompose a program into a set of small provable functions.

Removal of GOTO, and according to this paradigm all programs can be constructed from just three structures :-
1. Sequence
2. Selection
3. Iteration

Object Oriented Programming :-
Apart from many evasive definition, OO can be stated by three words :
1. Encapsulation
2. Inheritance
3. Polymorphism

The power of polymorphism provides us with :-
I. Dependency Inversion
II. Independent Deployability
III. Independent Develop-ability

Functional Programming :-
Variables in these languages do not vary (which basically taken away all the complications of concurrent applications).
Segregation of components, in such a way that Immutable components perform their tasks in a purely functional way. without using any mutable vars.

Photo by Mark Fletcher-Brown on Unsplash

Event Sourcing : is the way to use functional programming for modern applications. As per this we only store events (transactions) and do not update the state of a Var, and determine state (whenever required) via evaluating all the transactions on it.

--

--