Robust UI development with ClojureScript
Submitted by Sandilya Jandhyala (@jysandy) on Wednesday, 14 June 2017
Section: Full Talk Technical level: Intermediate Status: Rejected
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.
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.
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.