$30 off During Our Annual Pro Sale. View Details »

elm introduction at OK Lab Niederrhein

elm introduction at OK Lab Niederrhein

Elmar Burke

July 13, 2016
Tweet

More Decks by Elmar Burke

Other Decks in Technology

Transcript

  1. I'M ONE OF THE PEOPLE AT ANGULARJS.DE We have articles

    about AngularJS and Angular 2, a developer register and we give workshops!
  2. EVERYTHING STARTS WITH A Hello World main = span [class

    "welcome-message"] [text "Hello, World!"]
  3. "THE HISTORY OF PROGRAMMING" AS SEEN FROM JAVASCRIPT 1. Assembly

    - maintainability 2. C - memory management 3. Java - all those freakin' types 4. JavaScript - maintainability
  4. WHAT MAKES ELM SO GREATE > No runtime exceptions >

    Friendly Error Messages > Blazing fast rendering1 > Libraries with guarantees > Clean syntax > Smooth JavaScript interop 1 With the package elm-html
  5. LETS BUILD SOMETHING WE'LL BUILD A SIMPLE COUNTER IN ELM

    Go to elm-lang.org and grab the installer or head over to elm-lang.org/try
  6. THE ELM ARCHITECTURE > Model — the state of your

    application > Update — a way to update your state > View — a way to view your state as HTML
  7. import Html exposing (..) -- MODEL type alias Model =

    { ... } -- UPDATE type Msg = Reset | ... update : Msg -> Model -> Model update msg model = case msg of Reset -> ... ... -- VIEW view : Model -> Html Msg view model = ...
  8. import Html exposing (Html, button, div, text) import Html.App as

    Html import Html.Events exposing (onClick) main = Html.beginnerProgram { model = 0, view = view, update = update } type Msg = Increment | Decrement update msg model = case msg of Increment -> model + 1 Decrement -> model - 1 view model = div [] [ button [ onClick Decrement ] [ text "-" ] , div [] [ text (toString model) ] , button [ onClick Increment ] [ text "+" ] ]