Programming
Paradigms
• object oriented programming

• functional programming

• aspect programming

• declarative programming

• event-drivent programming
???
???
Paradigm : a framework of concepts, results, and
procedures within which subsequent work is structured.
Robert W. Floyd
“The advancement of the general art of
programming requires the continuing
invention and elaboration of paradigms.
The advancement of the art of the
individual programmer requires that he
expand his repertory of paradigms”
https://www.info.ucl.ac.be/~pvr/paradigms.html
What are the main
components ?
• how is the program flow decided ?

• how and where is the state stored and accessed ?

• how do we react to a state change ?

• how is concurrency managed ?

• is the program deterministic or non-deterministic ?

• how are real-life problems modelled in the language ?
What are the main
components ?
• how is the program flow decided ?
• how and where is the state stored and accessed ?
• how do we react to a state change ?
How is the flow decided ?
Imperative programming
• program describes a sequence of steps to change the
state (shared in most cases)

• explicit step-by-step control flow

• examples : Fortran, Pascal, BASIC, C
https://www.slideshare.net/billkarwin/sql-outer-joins-for-fun-and-profit
vs. declarative
programming
• program describes what the programmer wants to
achieve

• each declaration has a meaning on it’s own

• examples : SQL, Haskell
Imperative
• the program describes the
way of execution
Declarative
• the program tries to achieve
what the programmer tells it
to
Where is the state stored
and accessed ?
https://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming
State ?
What state ?
Functional programming
• declarative : desired computation is specified by composing
functions

• state and behaviour are separated

• functions take in data and output data

• pure functions don’t ever store state nor mutate the incoming
data

• output only depends on input

• side effects are limited
Event-loop programming
• a global loop is responsible for managing global state

• functions impact global or local state
Object-oriented
• An object is a mean to encapsulate state and behaviour

• It is responsible for modifying it’s internal state (this) so
the state is not shared

• Objects interact through message passing
How do we react to state
change ?
Passive
• one object is proactive and sends a message while the other is
passive

• the module that wants a change is responsible for defining the
change

• remote setters and updaters
Reactive
• one object sends a message and the other reacts to the
message being sent

• the module being changed is responsible for defining that
change

• events, observation and self-updates
Bonus : Functional Reactive
Programming
Functional Reactive
Programming
• https://github.com/staltz/manyverse
Merci !

Programming paradigms