The March edition of the London Clojurians coding dojo all the suggested dojo challenges were to be carried out with ClojureScript. After a long list of ideas we voted to do either Conway’s Game of Life or Monty Carlo graphics.
Getting started with ClojureScript seemed reminiscent of the challenge the group faced a couple of years ago when first trying out Clojure. Although getting started with Clojure itself is pretty easy these days, it feels like ClojureScript still has a way to go in terms of a great developer experience.
I looked at ClojureScript One and was put off a little by the amount of git projects it was downloading as part of its bootstrap process. I am sure its a great project, but seemed too much for the dojo and my netbook!
lein deps lein ring server-headless 3000
In hindsight, perhaps we should have looked at the advanced example that came with lein-cljsbuild, although we would probably have also run out of time with that too…
Perhaps if we had spent a bit of time before the dojo with the basics things would have gone better, however it was good to discover as a group the level of challenge involved and it made it easier to get started as we could draw from a range of experiences.
So what else did I learn?
The Google Closure library looks really great, but there seems to be a few challenges to get it to work with ClojureScript. Again this is down to our limited time to get to grips with several APIs, so we had little luck finding something that worked.
Our group got stuck on trying to find elements in the DOM via ClojureScript, repeatedly getting nil when asking for elements in the DOM. We postulated that is was a timing problem, but were not able to code around the problem.
We fired up the Chrome browser developer tools to see the errors, but couldn’t get any of the many fixes we found on Google to work.
Find an example ClojureScript project that works and is easy enough to understand - without having to spend an hour setting up Leiningen plugins and dependencies or having to download lots of things from the Internet. This was tricky to find in the time we had.
- Convex Hull ClojureScript demo - imagine27.com
- ClojureScript sample apps
- Google Closure: Getting Started
- Google Closure API documentation
So first impressions of the experience suggest I need to read some good tutorials on the subject and review code of some more projects. I plan on doing some more projects around Noir, so I’ll try and see where the advantages of using ClojureScript are when using a set of Clojure web frameworks.
I am still excited about ClojureScript, but its one of those things where I need to find more time than I have to get to grips with it. If anyone has any other blog or project recomendations, please let me know.
This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket