Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How the BEAM will change your mind

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.

Avatar for Laura M Castro

Laura M Castro

May 29, 2020
Tweet

More Decks by Laura M Castro

Other Decks in Technology

Transcript

  1. >>> How the BEAM will change your mind Name: Laura

    M. Castro (Universidade da Coru~ na, Spain) Date: May 29, 2020 [1/19]
  2. >>> What they say about FP * "Focuses on function

    evaluation, avoiding state and mutable data" [2/19]
  3. >>> What they say about FP * "Focuses on function

    evaluation, avoiding state and mutable data" * "Functions are pure, there are no side-effects" [2/19]
  4. >>> 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]
  5. >>> What they say about FP * "Code is written

    at a higher level, so it is cleaner, clearer, easier to reason about" [3/19]
  6. >>> 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]
  7. >>> 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]
  8. >>> 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]
  9. >>> 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]
  10. >>> What it means (an example) Project degree assignment process

    Students: * Must fulfill certain criteria Assignments: [6/19]
  11. >>> What it means (an example) Project degree assignment process

    Students: * Must fulfill certain criteria * Can request up to 5 assignments Assignments: [6/19]
  12. >>> What it means (an example) Project degree assignment process

    Students: * Must fulfill certain criteria * Can request up to 5 assignments Assignments: [6/19]
  13. >>> 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]
  14. >>> 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]
  15. >>> The imperative approach (a.k.a. the God complex) * Sees

    it all (data) * Knows it all (algorithm) [9/19]
  16. >>> The imperative approach (a.k.a. the God complex) * Sees

    it all (data) * Knows it all (algorithm) * Makes Their mighty will [9/19]
  17. >>> 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]
  18. >>> 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]
  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]
  20. >>> 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]
  21. >>> 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]
  22. >>> The functional approach (a.k.a. the Fellowship of the BEAM)

    * Each character has a personality and agenda [13/19]
  23. >>> 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]
  24. >>> 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]
  25. >>> 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]
  26. >>> How I solved the example Project degree assignment process

    (Fellowship of the BEAM edition) [15/19]
  27. >>> How I solved the example Project degree assignment process

    (Fellowship of the BEAM edition) * Each student is a process (supervised) [15/19]
  28. >>> 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]
  29. >>> 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]
  30. >>> 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]
  31. >>> 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]
  32. >>> 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]
  33. >>> 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]
  34. >>> 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]