Saturday, July 25, 2015

Comparing Clojure + Clojurescript with Scala + Scala.js

Even though I mostly use Java, Ruby, and Haskell, I have also been getting my head back into using Scala in my spare time. I took Martin Odersky's Functional Programming Principles in Scala class three years ago, and although I really enjoyed the class (he is a great lecturer!), I didn't much care for the tooling for Scala at that time. I ended up mostly using Clojure (with a little Haskell) for my day to day most used programming language.

I experimented with Scala.js a while back and thought that it compared well with Clojurescript. Sweet to write client code in either Clojurescript or Scala.js but I think that sometimes it is faster to not have the extra complexity and the need to transpile and just use plain old Javascript. I took a class in Typescript this year and really liked it but with ES6 quickly becoming a standard some of the benefits of Typescript go away.

This morning I was looking for an interesting template project using Scala for the backend and Scala.js for client code and ran across the impressive Widok project which supports a reactive web framework for the JVM and Scala.js. I have been experimenting this morning with the Widok skeleton client server starting project which provides niceties like automatic asset (SCSS to CSS, etc.) handling, auto re-compilation, etc. I don't have a need for using Widok right now but it is on my personal "watch list." Widok is really nicely done and the client server skeleton project is easy and fun to hack on.

Still, after three years I still find the tooling for Scala to be a bit heavy. I have a much faster laptop on order and that will help reduce the 5 or 10 second delay in processing changed assets and code for my work and generally experimenting with Scala, playing with Widok, etc..

Tooling is where Clojure and Clojurescript development really shine in my opinion. My Clojure setup allows me to edit server side code, Clojurescript client code, change hiccup template code, etc. and basically immediately see the results of code changes. I like that my hiccup templates are also Clojure code. It is fun to work on projects where everything is simply Clojure. Nice. I also like that I am not using any heavy weight frameworks, just a few libraires. This contrasts with richer development kits like Rails and Meteor.js which are fantastic when your application fits their application models. I like just using libraries and keeping the technology stack simple unless there is a particularly good fit for using something more complex.

1 comment:

Jim Lynch said...

Nice post. I haven't gotten into big projects or explored tooling options, but I'm liking Clojure syntax better than Scala. :)