JSFoo 2017

JSFoo is a conference about JavaScript and everything related.

Sandilya Jandhyala

@jysandy

Robust UI development with ClojureScript

Submitted Jun 14, 2017

ClojureScript is a variant of the functional programming language Clojure that compiles to JavaScript. Central philosophies of Clojure (and ClojureScript) are the notions of immutability and the separation of immutable, unchanging values from mutable state.
This talk will be an overview of ClojureScript and its ecosystem from a philosophical and architectural perspective, with the aim of showing the audience how these tools and architectures enable fast development while at the same time writing correct, bug-free code. I’ll explain how ClojureScript’s immutable data structures and its tools for carefully managing state can make programs easier to understand in and of themselves. Then I’ll talk about some ClojureScript tools and libraries.

Outline

Broadly, this is how I plan to structure my talk:

  • Discuss the importance of state management in user interfaces. A user interface is a giant blob of state. How do we manage this?
  • Introduce ClojureScript, its philosophy of immutability and separation of values from state. How do you get anything done if you can’t mutate? What are the tools for state management in ClojureScript? How does this make it a good fit for React?
  • Talk about Reagent, a ClojureScript wrapper for React. I’ll show how Reagent components can be written expressively as just a function of their parameters(props), and how Reagent atoms can be used to manage state.
  • A nice consequence of ClojureScript’s philosophy of carefully putting state in atoms is that hot code loading is simple to implement. I’ll talk about Figwheel, a hot code loader for ClojureScript. Figwheel makes feedback cycles very quick during development compared to traditional dev servers that refresh your browser when you change your code. This section will include a demo.
  • Can we make state mutations and side effects more predictable, instead of scattering them about our application? I’ll talk about re-frame, an application framework and state container based on Reagent. I’ll discuss the architecture of a re-frame app and its approach to working with side effects.
  • Talk about clojure.spec, a new library for specification and runtime validation of data. spec is not a type system; it is a system for specifying data as a composition of predicates. I’ll briefly cover the scope of spec, then explain how spec can be used with re-frame to validate the entire application state at runtime and detect errors quickly to avoid invalid and inconsistent state. This section will also include a small demo.

Speaker bio

Sandy is a developer at Nilenso, where he writes production quality Clojure and ClojureScript for their clients. Sandy spoke about clojure.spec as well at the Bangalore Clojure meetup -- see the link section for the code.

Slides

https://www.slideshare.net/SandilyaJandhyala1/moving-fast-without-breaking-things-with-clojurescript

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

JSFoo is a forum for discussing UI engineering; fullstack development; web applications engineering, performance, security and design; accessibility; and latest developments in #JavaScript. Follow JSFoo on Twitter more