elm - never get a runtime error anymore. almost

Post on 12-Apr-2017

327 Views

Category:

Software

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

ElmNever get a runtime error anymore. Almost.

Montage

Secret techniques for reliable projects

• Use pure functions• Avoid nulls• Immutability everywhere• Powerful type system• One global state• View is just a pure function of state

Elm

Has Haskell-like syntax, but thankfully it’s not Haskell

Elm• Pure language• No nulls• Everything is immutable• Compiler checks everything• Very opinionated

Elm Architecture

View

function

Model

data

Update

Action

function

EventHandlerevent

event

Elm Architecture is a fractal

EventHandlerevent

event

Model

UpdateView

Model

UpdateView

Model

UpdateView

ModelUpdate

View

Action

No, not really…

Cons• Very opinionated• Tooling• Dead Code Elimination• Immaturity• Runtime errors are still possible• Some things are hard to do• Almost no libraries for “production”• Poor coverage of modern browser APIs

Is it ready for production?It depends…

But if you learn it,it will make you a better JavaScript developer.

top related