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

REPL Driven Mobile Development with Clojure(script)

REPL Driven Mobile Development with Clojure(script)

Talk slides as presented in #FragmentsConf 2017.

Srihari Sriraman

September 13, 2017
Tweet

More Decks by Srihari Sriraman

Other Decks in Technology

Transcript

  1. REPL Driven
    Mobile Development
    with Clojure(script)
    Srihari Sriraman | nilenso

    View Slide

  2. View Slide

  3. when did you become an expert
    in building mobile applications?
    last night, ofc

    View Slide

  4. I have leapfrogged

    View Slide

  5. Why I am speaking about this
    Using cljsrn, we built the
    same app as a native team
    faster, and better.

    View Slide

  6. The things I will talk about
    Why
    REPL Driven Development
    CLJSRN
    Non tech factors

    View Slide

  7. Parlance

    View Slide

  8. REPL
    Https://en.wikipedia.org/wiki/
    Read–eval–print_loop
    Read, Eval, Print, Loop
    “interactive computer programming
    environment that takes single expressions,
    evaluates them,
    and returns the result to the user.

    View Slide

  9. REPL
    Https://en.wikipedia.org/wiki/
    Read–eval–print_loop
    Read, Eval, Print, Loop

    View Slide

  10. Lisp
    http://lisp-lang.org/
    LISt Processor
    Second oldest HLL
    Homoiconic

    View Slide

  11. Lisp
    http://lisp-lang.org/
    LISt Processor
    Second oldest HLL
    Homoiconic

    View Slide

  12. Clojure
    https://clojure.org/
    Clojure is a dialect of Lisp
    that runs on the JVM

    View Slide

  13. Clojure
    https://clojure.org/
    Clojure is a dialect of Lisp
    Runs on the JVM
    Rich Hickey

    View Slide

  14. Clojure(script)
    http://clojurescript.org/
    ClojureScript is a compiler
    for Clojure that targets JavaScript
    David Nolen

    View Slide

  15. Clojure(script)
    http://clojurescript.org/
    ClojureScript is a compiler
    for Clojure that targets JavaScript
    David Nolen

    View Slide

  16. CLJSRN
    http://cljsrn.org
    ClojureScript is a compiler
    for Clojure that targets JavaScript.
    A framework for building native
    apps using React

    View Slide

  17. Feedback

    View Slide

  18. Bret Victor - Inventing on Principle
    https://vimeo.com/36579366
    “Most of my time is spent in code,
    working in a text editor blindly, without an
    immediate connection to what I'm trying to make."

    View Slide

  19. View Slide

  20. View Slide

  21. View Slide

  22. View Slide

  23. View Slide

  24. View Slide

  25. Bret Victor - Inventing on Principle
    https://vimeo.com/36579366
    “Creators need an immediate connection
    to what they create”

    View Slide

  26. Stephen Wolfram – Inside the Wolfram Language
    https://www.youtube.com/watch?v=EjCWdsrVcBM

    View Slide

  27. Ron Garret - Lisping at JPL
    http://www.flownet.com/gat/jpl-lisp.html
    “Debugging a program running on a $100M piece
    of hardware that is 100 million miles away is an
    interesting experience. Having a read-eval-print
    loop running on the spacecraft proved invaluable
    in finding and fixing the problem.”

    View Slide

  28. Sam Aaron –Programming Music with Overtone - Sam Aaron
    https://www.youtube.com/watch?v=imoWGsipe4k
    Zach Oakes –Making Games at Runtime with Clojure
    https://www.youtube.com/watch?v=0GzzFeS5cMc
    Me – Making machines that make music
    https://www.youtube.com/watch?v=ZvSSeuzN_b4
    Clojure land

    View Slide

  29. REPL Driven
    Development

    View Slide

  30. Clojurescript
    Clojure Compiler Javascript
    Google Closure Compiler
    Optimized Javascript RN flow
    How cljsrn gets to a mobile

    View Slide

  31. Demo

    View Slide

  32. What is a REPL?
    More than a Shell
    Interact with running program
    Define and modify behaviour
    Read and write access to program’s state
    In the editor

    View Slide

  33. Why use a REPL?
    Why Clojure REPL?
    Why CLJS?

    View Slide

  34. Why use a REPL?
    Feedback
    Explore and internalise the problem
    Incremental development of the solution
    Faster than TDD
    Debuggability

    View Slide

  35. Why use a Clojure REPL?
    60y of LISP
    Functions and Data structures, mostly
    Read, Eval, and Print are overridable functions
    Access to runtime: Reflections as data
    Namespaces, vars

    View Slide

  36. Why clojurescript?
    Expressive, Simple
    Seamless JS Interop
    Immutable data structures by default
    Google closure

    View Slide

  37. Expressive, Simple
    Javascript
    Clojurescript

    View Slide

  38. Why clojurescript?
    Expressive, Simple
    Seamless JS Interop
    Immutable data structures by default
    Google closure

    View Slide

  39. Seamless JS interop

    View Slide

  40. Why clojurescript?
    Expressive, Simple
    Seamless JS Interop
    Immutable data structures by default
    Google closure

    View Slide

  41. Why clojurescript?
    Expressive, Simple
    Seamless JS Interop
    Immutable data structures by default
    Google closure

    View Slide

  42. Tools
    figwheel: watchman++
    re-frame: SPA framework (predates elm, redux)
    core.async: no callback hell!

    View Slide

  43. Reservations
    Hiring: Lisps are very different
    Learning: Community is small

    View Slide

  44. Non tech factors

    View Slide

  45. View Slide

  46. Undivided Team
    Ability to have a full picture
    Quick feedback cycles
    Well defined APIs
    No Specialists

    View Slide

  47. Unilingual Team
    “Use the source”
    Share code
    Make PRs across FE and BE
    Shared tools, and release processes

    View Slide

  48. View Slide

  49. REPL Driven
    Mobile Development
    with Clojure(script)
    Srihari Sriraman | nilenso

    View Slide