Let me preface this post by saying that I'm really not a ClojureScript developer (nor am I really even a Clojure developer). I've gone through a few episodes where I looked at Clojure, but I always deemed it as too crazy to actually be a viable programming language... until recently. There's something especially magical about Clojure's hot reload that makes it better than other hot reload tools; actually, two things:
Front End Frameworks Rise To Power
What the Heck is Clojure?
Unlike most mainstream programming languages, Clojure comes from the Lisp family of languages. This explains why Clojure looks so much different from other languages and why some coders can be very turned off by its syntax (seriously. If you aren't familiar with a Lisp go take a look at some Clojure code. It can be incredibly cryptic to the untrained eye). ClojureScript is not a very mainstream language, but it is built on extremely solid computer science principles and is quite stable now, almost 6 years after it was released in 2011 (and the original Clojure for JVM was created in 2007). Although it may seem like the the silver bullet language in some ways, there is a sizable learning curve for mastering Clojure. Not only that, you (assuming you are running a software organization) need to have programmers who want to learn and code in Clojure (which also is quite rare). Although I would not recommend anyone try to learn Clojure or ClojureScript as their first language, I think everyone should give it a fair chance because it's pretty dang awesome one you get the hang of it (although it can be quite an elusive hang to get).
Why Clojure's Hot Reload Is Scorching-Lava-Hot-As-The-Sun Hot!
Clojure is a pretty niche language and ClojureScript is even more so. Therefore, you could imagine that the tooling for it might not be as good as some of the more popular languages. Sure that was the case for a while... until figwheel came along. With figwheel (by the way, I have no idea where that name came from. You should ask it's creator, Bruce Hauman) as soon as you make a change in the code everything just updates... like magic. There is no browser reload. The change just takes effect in the app. There is no browser reload! Wow. No, seriously. This subtle difference actually makes ALL the difference. Regardless of which bundler you are using (browserify, webpack, or the hot new jazz of today) you still need to round up all of your files, convert them to JS / HTML / CSS, and ultimately load up a new instance of your application, thus losing your place in the webapp where you were before the refresh happened. So with figwheel our app just updates, reflecting the change in code, without restarting the app or changing anything about our state. Combine this with the sheer number of seconds saved by not waiting for your hot reloader to actually reload, add in a multiplier for how you never lose your "flow" or thought process because of the reloading, and one can begin to see how you could seriously improve your productivity by developing like this. This blew my mind the first time I learned about it, and it doubly blew my mind when I was able to witness a seasoned Clojure developer in action creating a site with this figwheel tool. It was truly magical, and I hereby formally endow the figwheel tool with considerably large props and thanks.
Should We All Switch to ClojureScript?
What Do You Think?
Are you a ClojureScript developer who uses fighweel? How are you liking it?
Leave a comment or tweet me @webWhizJim
The posts on this site are written and maintained by Jim Lynch. About Jim...