Share
Embed
How the BEAM will change your mind
This talk discusses different programming paradigms, focusing on functional programming (FP) and contrasting it with imperative and object-oriented approaches. It highlights advantages and challenges exploring the implications each of these paradigms brings in terms of software design.
Laura M Castro
May 29, 2020
Transcript
51 slides
-
>>> How the BEAM will change your mind Name: Laura
M. Castro (Universidade da Coru~ na, Spain) Date: May 29, 2020 [1/19] -
>>> What they say about FP * "Focuses on function
evaluation, avoiding state and mutable data" [2/19] -
>>> What they say about FP * "Focuses on function
evaluation, avoiding state and mutable data" * "Functions are pure, there are no side-effects" [2/19] -
>>> What they say about FP * "Focuses on function
evaluation, avoiding state and mutable data" * "Functions are pure, there are no side-effects" * "Functions are first-class citizens (high-order functions)" [2/19] -
>>> What they say about FP * "Code is written
at a higher level, so it is cleaner, clearer, easier to reason about" [3/19] -
>>> What they say about FP * "Code is written
at a higher level, so it is cleaner, clearer, easier to reason about" * "Code is more modular" [3/19] -
>>> What they say about FP * "Code is written
at a higher level, so it is cleaner, clearer, easier to reason about" * "Code is more modular" * "Code is easier to maintain" [3/19] -
>>> What they say about FP * "Code is written
at a higher level, so it is cleaner, clearer, easier to reason about" * "Code is more modular" * "Code is easier to maintain" * "Code is easier to test" [3/19] -
>>> What they say about FP * "Code is written
at a higher level, so it is cleaner, clearer, easier to reason about" * "Code is more modular" * "Code is easier to maintain" * "Code is easier to test" * "Parallelism / concurrency is easier" [3/19] -
>>> What it means (an example) Project degree assignment process
Students: Assignments: [6/19] -
>>> What it means (an example) Project degree assignment process
Students: * Must fulfill certain criteria Assignments: [6/19] -
>>> What it means (an example) Project degree assignment process
Students: * Must fulfill certain criteria * Can request up to 5 assignments Assignments: [6/19] -
>>> What it means (an example) Project degree assignment process
Students: * Must fulfill certain criteria * Can request up to 5 assignments Assignments: [6/19] -
>>> What it means (an example) Project degree assignment process
Students: * Must fulfill certain criteria * Can request up to 5 assignments Assignments: * Are bounded to concentrations [6/19] -
>>> What it means (an example) Project degree assignment process
Students: * Must fulfill certain criteria * Can request up to 5 assignments Assignments: * Are bounded to concentrations * Go to whoever has highest mark [6/19] -
>>> The imperative approach (a.k.a. the God complex) * Sees
it all (data) [9/19] -
>>> The imperative approach (a.k.a. the God complex) * Sees
it all (data) * Knows it all (algorithm) [9/19] -
>>> The imperative approach (a.k.a. the God complex) * Sees
it all (data) * Knows it all (algorithm) * Makes Their mighty will [9/19] -
>>> The imperative approach (a.k.a. the God complex) * Sees
it all (data) * Knows it all (algorithm) * Makes Their mighty will * Should the world fail, starts it all over again [9/19] -
>>> The object-oriented approach (a.k.a. Despicable master) * Each minion
knows its stuff (data) [11/19] -
>>> The object-oriented approach (a.k.a. Despicable master) * Each minion
knows its stuff (data) * Each minion knows how to go about its stuff (small tasks with own data) [11/19] -
>>> The object-oriented approach (a.k.a. Despicable master) * Each minion
knows its stuff (data) * Each minion knows how to go about its stuff (small tasks with own data) * A master needs to orchestrate The Plan (algorithm) [11/19] -
>>> The object-oriented approach (a.k.a. Despicable master) * Each minion
knows its stuff (data) * Each minion knows how to go about its stuff (small tasks with own data) * A master needs to orchestrate The Plan (algorithm) * Minions might or not comply [11/19] -
>>> The object-oriented approach (a.k.a. Despicable master) * Each minion
knows its stuff (data) * Each minion knows how to go about its stuff (small tasks with own data) * A master needs to orchestrate The Plan (algorithm) * Minions might or not comply * Failure of The Plan is not an option [11/19] -
>>> The functional approach (a.k.a. the Fellowship of the BEAM)
* Each character has a personality and agenda [13/19] -
>>> The functional approach (a.k.a. the Fellowship of the BEAM)
* Each character has a personality and agenda * Some may turn evil, some may be presumed dead, but life goes on [13/19] -
>>> The functional approach (a.k.a. the Fellowship of the BEAM)
* Each character has a personality and agenda * Some may turn evil, some may be presumed dead, but life goes on * Eventually, the story unfolds and milestones are reached [13/19] -
>>> The functional approach (a.k.a. the Fellowship of the BEAM)
* Each character has a personality and agenda * Some may turn evil, some may be presumed dead, but life goes on * Eventually, the story unfolds and milestones are reached * No one rules them all [13/19] -
>>> How I solved the example Project degree assignment process
(Fellowship of the BEAM edition) [15/19] -
>>> How I solved the example Project degree assignment process
(Fellowship of the BEAM edition) * Each student is a process (supervised) [15/19] -
>>> How I solved the example Project degree assignment process
(Fellowship of the BEAM edition) * Each student is a process (supervised) * Each assignment is a process (supervised) [15/19] -
>>> How I solved the example Project degree assignment process
(Fellowship of the BEAM edition) * Each student is a process (supervised) * Each assignment is a process (supervised) * There is a process who knows whether students fulfill criteria and their marks (i.e. administration window) (supervised) [15/19] -
>>> How I solved the example Project degree assignment process
(Fellowship of the BEAM edition) * Each student is a process (supervised) * Each assignment is a process (supervised) * There is a process who knows whether students fulfill criteria and their marks (i.e. administration window) (supervised) * There is a process who stores statistical information (explainability) (supervised) [15/19] -
>>> How I solved the example Project degree assignment process
(Fellowship of the BEAM edition) * Each student is a process (supervised) * Each assignment is a process (supervised) * There is a process who knows whether students fulfill criteria and their marks (i.e. administration window) (supervised) * There is a process who stores statistical information (explainability) (supervised) [15/19] -
>>> How I solved the example Project degree assignment process
(Fellowship of the BEAM edition) * Increased reliability * Distributed responsibility * Concurrent execution * Harder to control * Harder to explain * Harder to test [16/19] -
>>> What you can take home (pun intended) * Programming
paradigms do affect the way we think * Expand your problem-solving skills * Know their strengths and weaknesses * Use them wisely * Programming languages can be used in different ways * Respecting their paradigm is easier * Not everything is a nail [18/19] -
>>> What you can take home (pun intended) * Programming
paradigms do affect the way we think * Expand your problem-solving skills * Know their strengths and weaknesses * Use them wisely * Programming languages can be used in different ways * Respecting their paradigm is easier * Not everything is a nail The BEAM is the perfect environment for embracing pro-active small processes for increased reliability if you can afford to lose control in favour of eventual consistency [18/19]