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

MilanoJS 2017 - Elm in Production

MilanoJS 2017 - Elm in Production

Avatar for Marco Sampellegrini

Marco Sampellegrini

December 05, 2017

More Decks by Marco Sampellegrini

Other Decks in Programming

Transcript

  1. Agenda How I got to Elm What makes it unique

    Migrating an app to Elm @_alpacaaa // @Milano_JS
  2. same mistakes same mistakes u n d e f i

    n e d @_alpacaaa // @Milano_JS
  3. same mistakes same mistakes u n d e f i

    n e d same mistakes @_alpacaaa // @Milano_JS
  4. Insanity: doing the same thing over and over again and

    expecting different results. Einstein @_alpacaaa // @Milano_JS
  5. Hacker News Clone Routing Fetch data from GraphQL endpoint Non

    trivial UI state @_alpacaaa // @Milano_JS
  6. Common Myth #1 ­ FP Myth: Functional Programming == m

    a p ( ) . r e d u c e ( ) Truth: Functional Programming is about abstractions! @_alpacaaa // @Milano_JS
  7. Common Myth #2 ­ Tests Myth: Huge and complex Test

    suite == Lack of errors Writing unit tests is reinventing functional programming in non­ functional languages http://noss.github.io/2009/02/25/writing­unit­tests­is­reinventing­functional­programming­in­non­functional­languages.html @_alpacaaa // @Milano_JS
  8. Testing is washing the dishes. Automatic tests are a dishwasher.

    Types are proof that your dishes are not even dirty. https://twitter.com/runarorama/status/929754554111004672 @_alpacaaa // @Milano_JS
  9. Common Myth #3 ­ Types Myth: Static Typing == Java

    Truth: You can write Elm code without ever writing a type signature (not a great idea though). The type system in Elm is much more powerful and expressive. @_alpacaaa // @Milano_JS
  10. The static typing debate is silly. Instead the question must

    be, what can we prove about our programs before we run them & what is the cost? https://twitter.com/jdegoes/status/924035236035530752 @_alpacaaa // @Milano_JS
  11. Breaking News Elm does not have n u l l

    or u n d e f i n e d @_alpacaaa // @Milano_JS
  12. In case you don't know I call it my billion­dollar

    mistake. It was the invention of the null reference in 1965. Tony Hoare @_alpacaaa // @Milano_JS
  13. Well, unless... ­ ­ Y o u c a n

    f o r c e E l m t o c r a s h ! ­ ­ I n c a s e y o u m i s s J S f r o m t i m e t o t i m e . . . D e b u g . c r a s h " L O L r u n t i m e e r r o r s ! " ( ) @_alpacaaa // @Milano_JS
  14. reactjs/redux Redux evolves the ideas of Flux, but avoids its

    complexity by taking cues from Elm. @_alpacaaa // @Milano_JS
  15. I noticed that everyone who successfully introduces Elm at work

    tells the same story. They introduce Elm gradually into an existing JS project. This process works because it minimizes risk. Evan Czaplicki (Author of Elm) @_alpacaaa // @Milano_JS
  16. Our Master plan Modify current app as little as possible

    Start serving the new Elm app at a specific route @_alpacaaa // @Milano_JS
  17. In practice Elixir backend served the correct app depending on

    route Elm app would serve requests to / d o c u m e n t s Angular app would serve all other requests @_alpacaaa // @Milano_JS
  18. Ecosystem http://package.elm­lang.org/ Use p o r t s for everything

    that's not available as a native package. @_alpacaaa // @Milano_JS
  19. Elm is great for teams. The Elm Architecture e l

    m ­ f o r m a t @_alpacaaa // @Milano_JS
  20. That should be an inspiration for every error message. John

    Carmack https://twitter.com/id_aa_carmack/status/735197548034412546 @_alpacaaa // @Milano_JS
  21. Unconventional development model Single person working on the Elm compiler,

    full time Not very open to contribution Elm releases take a while, focus on doing things right It's done when it's done @_alpacaaa // @Milano_JS
  22. Alternatives Typescript (with f p ­ t s ) Purescript

    ReasonML Fable (F#) @_alpacaaa // @Milano_JS