Opening Keynote — BEAM to the Future: Old Ideas Made New

A presentation at CodeBEAM SF in March 2020 in San Francisco, CA, USA by Brooklyn Zelenka

Slide 1

Slide 1

M A E B e r u t to u f e h t W E N E D A M S A E D I D L O

Slide 2

Slide 2

#CODEBEAMSF Sometimes in order to keep moving forward, not only must you take one step at a time, but you must be willing to look back occasionally and evaluate your past, no matter how painful it is. Looking back lets you know whether or not you are headed in the right direction. – G.K. ADAMS

Slide 3

Slide 3

#CODEBEAMSF Epigram 53 So many good ideas are never heard from again once they embark in a voyage on the semantic gulf – A L A N J. P E R L I S , E P I G R A M S O N P RO G R A M M I N G ( 1 9 8 2 )

Slide 4

Slide 4

#CODEBEAMSF M E TA

Slide 5

Slide 5

M E TA B R O O K LY N Z E L E N K A , @ e x p e d e • Cofounder/CTO at Fission • https://fission.codes • Web native apps (“post-serverless”) • Goal: make back-end & DevOps obsolete 😈 • PLT & VMs • Prev. Ethereum Core Developer • Founded VanFP & VanBEAM • Primary author of Witchcraft Suite, Exceptional, &c #CODEBEAMSF

Slide 6

Slide 6

M E TA #CODEBEAMSF DISCOVER THE FUTURE OF ERLANG AND ELIXIR

Slide 7

Slide 7

M E TA #CODEBEAMSF THE BEAM DOES SO MUCH RIGHT 👏

Slide 8

Slide 8

M E TA #CODEBEAMSF H OW D O W E M O V E FO R WA R D AS A N E C O SYST E M , C R O S S L A N G U A G E , C R O S S PA R A D I G M ?

Slide 9

Slide 9

M E TA LOCAL MAXIMA #CODEBEAMSF 😍 😄 😭

Slide 10

Slide 10

M E TA SPOILER ALERT 🚨

  1. Breaking out of linear thinking / von Neumann 🌀 2. New types of modularity (for the BEAM) 🔌 3. Composable languages 🗣 #CODEBEAMSF

Slide 11

Slide 11

#CODEBEAMSF IN THE BEGINNING… 🌴🦖

Slide 12

Slide 12

IN THE BEGINNING… 🌴🦖 #CODEBEAMSF Epigram 28 Around computers it is difficult to find the correct unit of time to measure progress. Some cathedrals took a century to complete. Can you imagine the grandeur and scope of a program that would take as long? – A L A N J. P E R L I S , E P I G R A M S O N P RO G R A M M I N G ( 1 9 8 2 )

Slide 13

Slide 13

IN THE BEGINNING… 🌴🦖 29 years #CODEBEAMSF 34 years

Slide 14

Slide 14

#CODEBEAMSF PA R A D I G M R E D S H I F T

Slide 15

Slide 15

PA R A D I G M R E D S H I F T #CODEBEAMSF It’s really difficult to distinguish a new paradigm from a really bad idea […] The new shiny object is part of the old paradigm – D O U G L A S C R O C K F O R D , T H E P O W E R O F T H E PA R A D I G M ( 2 0 1 8 )

Slide 16

Slide 16

PA R A D I G M R E D S H I F T N O V E LT Y B U D G E T #CODEBEAMSF

Slide 17

Slide 17

PA R A D I G M R E D S H I F T L A W O F C O N S E R VAT I O N O F C O M P L E X I T Y Every application has an inherent amount of complexity that cannot be removed or hidden, but only moved from place to place – LARRY TESLER #CODEBEAMSF

Slide 18

Slide 18

PA R A D I G M R E D S H I F T T H E “ W H AT I F ” T R E E #CODEBEAMSF 3. SML Module System 🔌 4. Natural & Biz Language 🕴 ✂ 2. Applicative Model 🤹 ✂

  1. Array-based 📈

Slide 19

Slide 19

PA R A D I G M R E D S H I F T #CODEBEAMSF L E T ’ S S TA R T W I T H S O M E T H I N G A L I E N 🛸👽

Slide 20

Slide 20

PA R A D I G M R E D S H I F T SOMETHING ALIEN #CODEBEAMSF LIFE←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵} Attribution: wikipedia user LucasVB

Slide 21

Slide 21

PA R A D I G M R E D S H I F T W H AT C A N W E L E A R N F R O M A P L? C E L L U L A R A U T O M ATA & A C T O R S A S O R G A N I S M S 🌸 • Each step is very simple • Reasoning about dynamic organisms is hard • Emergent behaviour 😱 • VM in your brain to reason at a higher level • We can abstract some of this away • Broadway • Arrows #CODEBEAMSF

Slide 22

Slide 22

PA R A D I G M R E D S H I F T W H AT C A N W E L E A R N F R O M A P L? U N I V E R S A L S C A L I N G L AW #CODEBEAMSF Amdahl’s Law Incoherence Penalty http://www.perfdynamics.com/Manifesto/USLscalability.html USL

Slide 23

Slide 23

#CODEBEAMSF PA R A D I G M R E D S H I F T W H AT C A N W E L E A R N F R O M A P L? D O A L L / A U T O M AT I C PA R A L L E L I S M / C Y C L I C M U LT I T H R E A D I N G 🔄

  1. Shared-nothing architecture 2. Good for embarrassingly parallel problems 3. Macro could do a LOT more with this at compile-time 4. Impurity and granular control mean that we don’t get this by default (with good reason)

Slide 24

Slide 24

PA R A D I G M R E D S H I F T OTP → TOP TA B L E O R I E N T E D P R O G R A M M I N G #CODEBEAMSF

Slide 25

Slide 25

PA R A D I G M R E D S H I F T TA B L E - O R I E N T E D P R O G R A M M I N G N A I V E TA B L E S #CODEBEAMSF Name Handle City Brooklyn expede Va n c o u ve r Boris bmann Va n c o u ve r Steven icidasset Ghent

Slide 26

Slide 26

PA R A D I G M R E D S H I F T TA B L E - O R I E N T E D P R O G R A M M I N G P E R F E C T LY PA R A L L E L C O N T R O L TA B L E S #CODEBEAMSF Functions Zero dependencies by definition Data

Slide 27

Slide 27

PA R A D I G M R E D S H I F T TA B L E - O R I E N T E D P R O G R A M M I N G THE NTH-DIMENSION 🚀 #CODEBEAMSF

Slide 28

Slide 28

PA R A D I G M R E D S H I F T TA B L E - O R I E N T E D P R O G R A M M I N G #CODEBEAMSF

Slide 29

Slide 29

#CODEBEAMSF COMPOSITION & MODULARITY

Slide 30

Slide 30

COMPOSITION & MODULARITY #CODEBEAMSF Epigram 6 Symmetry is a complexity-reducing concept; seek it everywhere. Epigram 105 You can’t communicate complexity, only an awareness of it. – A L A N J. P E R L I S , E P I G R A M S O N P RO G R A M M I N G , 1 9 8 2

Slide 31

Slide 31

COMPOSITION & MODULARITY #CODEBEAMSF W H AT D O Y O U M E A N BY “C O M P O SA B L E ” ?

Slide 32

Slide 32

COMPOSITION & MODULARITY W H AT D O Y O U M E A N B Y “ C O M P O S I T I O N ” ? Orthogonality #CODEBEAMSF Commutativity Modularity HOF Composition

Slide 33

Slide 33

COMPOSITION & MODULARITY W H AT D O Y O U M E A N B Y “ C O M P O S I T I O N ” ? #CODEBEAMSF FOCUS Composition of the data dimension a b c d e

Slide 34

Slide 34

COMPOSITION & MODULARITY W H AT D O Y O U M E A N B Y “ C O M P O S I T I O N ” ? #CODEBEAMSF FOCUS Composition of the function dimension f g w flo ta Da h

Slide 35

Slide 35

COMPOSITION & MODULARITY W H AT D O Y O U M E A N B Y “ C O M P O S I T I O N ” ? FOCUS Composition of capabilities (protocols and HOFs) data function 🔁 #CODEBEAMSF

Slide 36

Slide 36

COMPOSITION & MODULARITY W H AT D O Y O U M E A N B Y “ C O M P O S I T I O N ” ? EXECUTION ORTHOGONALITY #CODEBEAMSF A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics. – R O B E R T H A R P E R , P R A C T I C A L F O U N D AT I O N S F O R P R O G R A M M I N G L A N G U A G E S , 2 0 1 2 t m m o c It 👍 ! s e ut

Slide 37

Slide 37

COMPOSITION & MODULARITY W H AT D O Y O U M E A N B Y “ C O M P O S I T I O N ” ? E X P L I C I T D ATA F L O W #CODEBEAMSF

Slide 38

Slide 38

COMPOSITION & MODULARITY HOW MODULAR ARE MODULES? (AND LIBRARIES) #CODEBEAMSF

Slide 39

Slide 39

COMPOSITION & MODULARITY HOW MODULAR ARE MODULES? MODULE-LEVEL MODULARITY “hot-swappable dependencies” #CODEBEAMSF

Slide 40

Slide 40

COMPOSITION & MODULARITY HOW MODULAR ARE MODULES? HACKING EXTENDING THE MODULE SYSTEM 😉 #CODEBEAMSF

Slide 41

Slide 41

COMPOSITION & MODULARITY HOW MODULAR ARE MODULES? HIGHER ORDER MODULES 💖 B E H AV I O U R S #CODEBEAMSF

Slide 42

Slide 42

#CODEBEAMSF D E C L A R AT I V E E M B E D D E D D S L S 🍏🍊

Slide 43

Slide 43

D E C L A R AT I V E E M B E D D E D D S L S #CODEBEAMSF I have regarded it as the highest goal of programming language design to enable good ideas to be elegantly expressed – TO N Y H O A R E , T U R I N G AWA R D L E C T U R E , 1 9 8 0

Slide 44

Slide 44

D E C L A R AT I V E E M B E D D E D D S L S I S N ’ T E V E R Y T H I N G A D S L? a P d ra m ig Wide t a P n r te e g u a g n a L #CODEBEAMSF D L S a r F k r o w e m e c a f r e t In c i l p p A Narrow t a n io

Slide 45

Slide 45

D E C L A R AT I V E E M B E D D E D D S L S I S N ’ T E V E R Y T H I N G A D S L? COUNTEREXAMPLE THIS IS JUST ELIXIR! #CODEBEAMSF

Slide 46

Slide 46

D E C L A R AT I V E E M B E D D E D D S L S A L G E B R A I C D ATA T Y P E E D S L #CODEBEAMSF

Slide 47

Slide 47

D E C L A R AT I V E E M B E D D E D D S L S #CODEBEAMSF BUSINESS LANGUAGE FOR BUSINESS TIME 💼

Slide 48

Slide 48

D E C L A R AT I V E E M B E D D E D D S L S BUSINESS LANGUAGE #CODEBEAMSF W H AT C A N W E L E A R N F R O M C O B O L? ( Y E S . R E A L LY. C O B O L . ) – Toggl, How to Kill at the Dragon in 9 Programming Languages

Slide 49

Slide 49

D E C L A R AT I V E E M B E D D E D D S L S W H AT C A N W E L E A R N F R O M C O B O L? #CODEBEAMSF

Slide 50

Slide 50

D E C L A R AT I V E E M B E D D E D D S L S W H AT C A N W E L E A R N F R O M C O B O L? W H E N N O O N E W A N T S T O G O T O J A I L 👩⚖ • Needs to be readable by lawyers • i.e. who can’t read code • Formal methods / static analysis • Including the compiler, of course • An unholy union of COBOL and Prolog #CODEBEAMSF

Slide 51

Slide 51

D E C L A R AT I V E E M B E D D E D D S L S UPSIDE

  1. Great for communicating with domain experts 2. We know how these DSLs work (e.g. they form an algebra) 3. They can be correct-by-construction 4. Check for various properties 1. Compile- or run-time 5. A language that exactly fits your needs (DDD) #CODEBEAMSF

Slide 52

Slide 52

D E C L A R AT I V E E M B E D D E D D S L S #CODEBEAMSF B U T W E H AV E A P R O B L E M 😱 H I N T: I T ’S I N F L E X I B I L I T Y

Slide 53

Slide 53

D E C L A R AT I V E E M B E D D E D D S L S #CODEBEAMSF 🏖 SHALLOW EMBEDDING 🦀 T H E Q U I C K A N D D I R T Y W AY

Slide 54

Slide 54

D E C L A R AT I V E E M B E D D E D D S L S SHALLOW EMBEDDING • Just use the built-in AST • What it can represent is limited • e.g. Ecto, Algae #CODEBEAMSF

Slide 55

Slide 55

D E C L A R AT I V E E M B E D D E D D S L S #CODEBEAMSF 🌊 DEEP EMBEDDING 🦈 “BE T TER AST ”

Slide 56

Slide 56

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING THREE STEPS

  1. Build a game plan 2. Transform (optional) 3. Tear down #CODEBEAMSF

Slide 57

Slide 57

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING “BUILD A PLAN” EXAMPLE #CODEBEAMSF

Slide 58

Slide 58

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING TRADEOFFS #CODEBEAMSF • More work to write (write your own AST) • Way more powerful (full control) • Precisely the vocabulary that you need — exact surface area • Can check more things about the meaning of your code • Logic-as-data is MUCH simpler to debug than running functions • Time travelling debugging! • Unlike protocols, you’re not locked into one canonical implementation

Slide 59

Slide 59

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING COMBINE POWERFUL, MODULAR, REUSABLE DSLS! #CODEBEAMSF

Slide 60

Slide 60

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING DESUGAR #CODEBEAMSF

Slide 61

Slide 61

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING HUH, KINDA THIS FEELS LIKE GENSERVER #CODEBEAMSF

Slide 62

Slide 62

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING WITH THEIR POWERS COMBINED! #CODEBEAMSF

Slide 63

Slide 63

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING ONE LAST LINE #CODEBEAMSF

Slide 64

Slide 64

D E C L A R AT I V E E M B E D D E D D S L S DEEP EMBEDDING MORE FLEXIBLE THAN PROTOCOLS #CODEBEAMSF

  1. Protocols require canonicity 2. Libraries of well-defined mini-languages, even without interpreter 3. Different in tests and prod (trivial to mock)

Slide 65

Slide 65

#CODEBEAMSF L E T ’ S M A K E N E W M I S TA K E S ! 💥 ✨ 5 PROBLEMS FOR THE NEXT 30 YEARS OF BEAM

Slide 66

Slide 66

L E T ’ S M A K E N E W M I S TA K E S 5 PROBLEMS FOR THE NEXT 30 YEARS OF BEAM #CODEBEAMSF

  1. Wasm — client & edge BEAM 2. Lower the barrier to entry (low code) 3. Correctness tools (i.e. better static & dynamic analysis, formal methods) 4. Automatic dynamic parallel evaluation 5. Mobile agents (incl. dynamic FaaS)

Slide 67

Slide 67

#CODEBEAMSF PA R T I N G T H O U G H T 🧠

Slide 68

Slide 68

PA R T I N G T H O U G H T 🧠 #CODEBEAMSF Epigram 101 Dealing with failure is easy: work hard to improve. Success is also easy to handle: you’ve solved the wrong problem. Work hard to improve. – A L A N J. P E R L I S , E P I G R A M S O N P RO G R A M M I N G ( 1 9 8 2 )

Slide 69

Slide 69

#CODEBEAMSF 🇺🇸 T H A N K Y O U , S A N F R A N C I S C O 🎉 brooklyn@fission.codes g i t h u b . c o m /e x p e d e @expede