SlideShare a Scribd company logo
Elixir and Elm – the perfect couple
Tomasz Kowal
What is this talk about?
● Programming web applications
● Patterns applicable not only in Elm and Elixir
– single source of truth
– one directional flows
● How programming languages shape programs?
● Why is it a good idea to use more than one
programming language in your app?
Why new programming languages?
● functional vs imperative
● languages are defined by what is easy to do
● but sometimes even more by what is HARD
++++++++[>++++[>++>+++>++
+>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..++
+.>>.<-.<.+++.------.--------.>>+.>++.
Erlang – made for fault tolerance
● Easy concurrency
● Easy distribution
● Easy debugging
● Easy messaging
● Impossible sharing memory
● Impossible reassigning variables
● Relatively hard string manipulation
Elixir – made for web
● Metaprogramming
● Strings done well
● Inherits all good and bad sides of Erlang
Elm – made for browser
● Static typing
● Almost no runtime exceptions
● Very easy to follow programming model
I hate language comparisons
The Blub paradox
Power continuum
Elixir and elm - the perfect couple
"it is, all other things being equal, a mistake to
program in anything but the most powerful
[programming language]”
- Paul Graham
"it is, all other things being equal, a mistake to
program in anything but the most suitable
language for the problem domain”
- Tomasz Kowal
- interactive frontend
- available backend
Objective measure
„number of things, you need to keep in mind to
understand given code fragment”
„programmers memory consumption”
PMC
Functional languge
def function(arg1, arg2) do
value = some_computations(arg1)
another_value = some_computations(arg2)
value + another_value
end
Functional languge
def function(arg1, arg2) do
value = some_computations(arg1)
another_value = some_computations(arg2)
value + another_value
end
Functional languge
def function(arg1, arg2) do
value = some_computations(arg1)
another_value = some_computations(arg2)
value + another_value
end
Functional languge
def function(arg1, arg2) do
value = some_computations(arg1)
another_value = some_computations(arg2)
value + another_value
end
PMC = 4
OO Language
def method(arg1, arg2) do
value = some_computation(arg1 + property1)
property2 = some_computation(arg2)
value + property2
end
OO Language
property1
property2
def method(arg1, arg2) do
value = some_computation(arg1 + property1)
property2 = some_computation(arg2)
value + property2
end
Building frontend
"modifying document object model by reacting to
events from user and server"
Frontend programming
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
Frontend programming
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
Frontend programming
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
Frontend programming
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
Everything that is syntactically legal that the
compiler will accept will eventually wind up in your
codebase.
- John Carmack
Elixir and elm - the perfect couple
Signals
tHTML
HTML’
HTML’’
Signals
tHTML
HTML’
HTML’’
User input
Server event
User input’
Signals
tHTML
HTML’
HTML’’
User input
Server event
User input’
model
model’
model
model’’
update
Signals
tHTML
HTML’
HTML’’
User input
Server event
User input’
model
model’
model
model’’
update view
Signals
tHTML
HTML’
HTML’’
User input
Server event
User input’
model
model’
model
model’’
update view
Pure functions!
Single data structure holds entire application
state.
Backend programming
Backend programming
Backend programming
Backend programming - netsplit
Actors
msg
actor actor’
(queue msg)
t
Actors
msg
msg’
actor actor’
process msg’
(queue msg)
other msg process other msg
t
Actors
msg
msg’
actor
other msg’
actor’
process msg’
process msg
(queue msg)
other msg process other msg
t
(/dev/null)
Actors
msg
msg’
msg’’
actor
other msg’
actor’
process msg’
process msg
(queue msg)
other msg
(/dev/null)
process other msg
t
(/dev/null)
Actors
msg
msg’
msg’’
actor
other msg’
actor’
process msg’
process msg
(queue msg)
other msg
(/dev/null)
process other msg
t
(/dev/null)
Is actor alive/reachable?
Notify on death
Kill from outside
Kill and restart group of actors
Elixir
def function(arg1, arg2) do
val = receive msg of
{:msg, msg} -> msg
end
val + arg1 + arg2
end
CAP
Elixir and elm - the perfect couple
Conn
Enpoint.call(conn, opts) → conn
Router.call(conn, opts) → conn
Router.browser(conn, opts) → conn
MyController.index(conn, params) → conn
Auth.authenticate(conn, repo) → conn
conn |> endpoint |> router |> pipelines |>
controller
conn |> controller |> common_services |> action
- Single data structure (source of truth)
- flow in one direction
Elixir and elm - the perfect couple
Connecting Phoenix and Elm
● Phoenix Channels
● Phoenix asset pipeline
● Elm ports
● Elm signals
Resources
Elm lang homepage: http://elm-lang.org/
Elm architecture https://github.com/evancz/elm-architecture-tutorial
Different FRP model https://www.youtube.com/watch?v=Agu6jipKfYw
Time traveling debugger http://debug.elm-lang.org/
Elixir lang homepage: http://elixir-lang.org/
Phoenix framework: http://www.phoenixframework.org/
Programming Phoenix:
https://pragprog.com/book/phoenix/programming-phoenix
Elixir + Elm tutorial http://www.cultivatehq.com/posts/phoenix-elm-1/
Elm + Elixir keynote https://www.youtube.com/watch?v=XJ9ckqCMiKk
My blog: http://tkowal.wordpress.com/
Things to remember #1
Different programming languages solve different
problems.
Things to remember #2
For interactive web applications check out both
Elixir and Elm
Things to remember #3
If you like this talk, follow me on Twitter
@snajper47

More Related Content

PDF
Domain Driven Rails
Yan Pritzker
 
PDF
The CQRS diet
Luismi Cavallé
 
PPTX
Relay: Seamless Syncing for React (VanJS)
Brooklyn Zelenka
 
PDF
Implementing OpenCL support in GEGL and GIMP
lgworld
 
PDF
GraphQL With Relay Part Deux
Brad Pillow
 
PDF
Introducing Spring Auto REST Docs - Spring IO 2017
Florian Benz
 
PDF
Front-end God Mode with Reagent and Figwheel
David Kay
 
PDF
Intuitive CLIs for gRPC - GoSV Jan '19
Noah Dietz
 
Domain Driven Rails
Yan Pritzker
 
The CQRS diet
Luismi Cavallé
 
Relay: Seamless Syncing for React (VanJS)
Brooklyn Zelenka
 
Implementing OpenCL support in GEGL and GIMP
lgworld
 
GraphQL With Relay Part Deux
Brad Pillow
 
Introducing Spring Auto REST Docs - Spring IO 2017
Florian Benz
 
Front-end God Mode with Reagent and Figwheel
David Kay
 
Intuitive CLIs for gRPC - GoSV Jan '19
Noah Dietz
 

Viewers also liked (12)

PDF
Functional web with elixir and elm in phoenix
Izzet Mustafaiev
 
PDF
Elm a possible future for web frontend
Gaetano Contaldi
 
PDF
Claudia Doppioslash - Time Travel for game development with Elm
Codemotion
 
PDF
Elm: frontend code without runtime exceptions
Pietro Grandi
 
ODP
Very basic functional design patterns
Tomasz Kowal
 
PDF
Elm: delightful web development
Amir Barylko
 
PDF
Functional Web Development using Elm
💻 Spencer Schneidenbach
 
PDF
Rethink Frontend Development With Elm
Brian Hogan
 
PDF
A recommendation engine for your applications - M.Orselli - Codemotion Rome 17
Codemotion
 
PDF
Self-testing Code
Rogerio Chaves
 
PDF
Introduction to Elm
Rogerio Chaves
 
Functional web with elixir and elm in phoenix
Izzet Mustafaiev
 
Elm a possible future for web frontend
Gaetano Contaldi
 
Claudia Doppioslash - Time Travel for game development with Elm
Codemotion
 
Elm: frontend code without runtime exceptions
Pietro Grandi
 
Very basic functional design patterns
Tomasz Kowal
 
Elm: delightful web development
Amir Barylko
 
Functional Web Development using Elm
💻 Spencer Schneidenbach
 
Rethink Frontend Development With Elm
Brian Hogan
 
A recommendation engine for your applications - M.Orselli - Codemotion Rome 17
Codemotion
 
Self-testing Code
Rogerio Chaves
 
Introduction to Elm
Rogerio Chaves
 
Ad

Similar to Elixir and elm - the perfect couple (20)

PDF
Introduction to functional programming
Konrad Szydlo
 
PPTX
Dart the Better JavaScript
Jorg Janke
 
PDF
Apache Airflow® Best Practices: DAG Writing
Aggregage
 
PPTX
Things about Functional JavaScript
ChengHui Weng
 
PDF
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
 
PPTX
AestasIT - Internal DSLs in Scala
Dmitry Buzdin
 
PDF
Code Cleanup: A Data Scientist's Guide to Sparkling Code
Corrie Bartelheimer
 
KEY
Remix Your Language Tooling (JSConf.eu 2012)
lennartkats
 
PDF
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Codemotion
 
PPT
Groovy Update - JavaPolis 2007
Guillaume Laforge
 
PDF
Software Development Automation With Scripting Languages
Ionela
 
PDF
Declarative Infrastructure Tools
Yulia Shcherbachova
 
KEY
AMD - Why, What and How
Mike Wilcox
 
PDF
FastR+Apache Flink
Juan Fumero
 
PDF
Easy deployment & management of cloud apps
David Cunningham
 
PPTX
Golang
Fatih Şimşek
 
PPTX
Extreme Apache Spark: how in 3 months we created a pipeline that can process ...
Josef A. Habdank
 
PDF
Sharable of qualities of clean code
Eman Mohamed
 
PDF
(1) c sharp introduction_basics_dot_net
Nico Ludwig
 
Introduction to functional programming
Konrad Szydlo
 
Dart the Better JavaScript
Jorg Janke
 
Apache Airflow® Best Practices: DAG Writing
Aggregage
 
Things about Functional JavaScript
ChengHui Weng
 
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
 
AestasIT - Internal DSLs in Scala
Dmitry Buzdin
 
Code Cleanup: A Data Scientist's Guide to Sparkling Code
Corrie Bartelheimer
 
Remix Your Language Tooling (JSConf.eu 2012)
lennartkats
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Codemotion
 
Groovy Update - JavaPolis 2007
Guillaume Laforge
 
Software Development Automation With Scripting Languages
Ionela
 
Declarative Infrastructure Tools
Yulia Shcherbachova
 
AMD - Why, What and How
Mike Wilcox
 
FastR+Apache Flink
Juan Fumero
 
Easy deployment & management of cloud apps
David Cunningham
 
Extreme Apache Spark: how in 3 months we created a pipeline that can process ...
Josef A. Habdank
 
Sharable of qualities of clean code
Eman Mohamed
 
(1) c sharp introduction_basics_dot_net
Nico Ludwig
 
Ad

Recently uploaded (20)

PDF
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PPTX
Presentation about variables and constant.pptx
safalsingh810
 
PDF
Download iTop VPN Free 6.1.0.5882 Crack Full Activated Pre Latest 2025
imang66g
 
PDF
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
PPTX
TRAVEL APIs | WHITE LABEL TRAVEL API | TOP TRAVEL APIs
philipnathen82
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
Immersive experiences: what Pharo users do!
ESUG
 
PDF
vAdobe Premiere Pro 2025 (v25.2.3.004) Crack Pre-Activated Latest
imang66g
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PPTX
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PDF
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
Presentation about variables and constant.pptx
safalsingh810
 
Download iTop VPN Free 6.1.0.5882 Crack Full Activated Pre Latest 2025
imang66g
 
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
TRAVEL APIs | WHITE LABEL TRAVEL API | TOP TRAVEL APIs
philipnathen82
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Immersive experiences: what Pharo users do!
ESUG
 
vAdobe Premiere Pro 2025 (v25.2.3.004) Crack Pre-Activated Latest
imang66g
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 

Elixir and elm - the perfect couple