Tonight I gave a lightning talk about Pedestal at the San Francisco ClojureScript meetup. I’m still working through the tutorial so my understanding and experience are both limited, but this was a good chance to gather my thoughts.
Most people hadn’t worked with Pedestal so even though I’m still learning, there was a lot to share and a lot of good questions. Here are the notes I presented.
What is Pedestal?
- Web applications, not pages
- Designed for interactive, 2 way transfer of info to/from multiple sources
- Framework, not Library. You put your code in the right place and Pedestal infrastructure calls it
What’s in the Box
- Pedestal Services – for the server
- Pedestal Applications – for the web client
- Control flow via dataflow, messages, queues, not sequential logic
- Easy recording/playback of messages
- Separate concerns
- Design without application code using a sequence of played-back messages
- Develop client without the server using simulated backends that generated messages
- Services and applications don’t even go in the same project
How Does It Work?
- Application split into 3 layers:
- Data model – data you’re holding
- Application model – “shape” of the data in the rendered view
- Rendered view
- You can also cause non-rendering side effects: any side effects of changing data/application models, eg write to server, fire analytics
- Handle inputs to update data model
- Handle updates to data model to update application model, update downstream changes to data model, or send side-effects
- Handle updates to application model by making targeted rendering updates
- Queues for input, app-model, effects
Why I Like It
- Makes data and UI changes functional rather than stateful
- Separation of concerns makes each part of the app simpler
- Record and replay of events makes designing and debugging more predictable
- Reminds me of Rails up/down migrations for data consistency
- Strong opinions different from other web frameworks and libraries and more inline with my software views
- Reflects experience of experienced web devs
- It’s Clojure-y!