===================
== Martin Trojer ==
Programming Blog

===================

Scala and me

fsharp scala clojure sicp

This epic journey (yeah right) began at university with discovering the mighty SICP, still the best book on programming I’ve read (and let’s face it, the best I will ever read). After that profound experience, I kept an eye on the Lisp/FP world and wrote some toys in Scheme, ELisp, and OCaml every now and then. One thing that dawned on me was that none of these languages had much practical use; they weren’t very applicable to real-world software problems. While very clever and mind-expanding, they seemed mainly an academic exercise. There were zero jobs out there using these languages. Heck, hardly any of my peers had heard of or cared about them.

Another problem with the early FP languages, which didn’t become clear to me until Java really took off, was that all those languages were islands. They had close to no libraries, so if you wanted to write an application with UI, socket connections, etc., you were stuck reinventing wheels. It made choosing such a language practically impossible.

My FP fire was rekindled in a big way when I joined a company in 2011, where an ex-Microsoft Research hacker (Phil Trelford) introduced me to F#. I was aware of F#, but hadn’t realized the most profound difference between F# and OCaml: it was a very practical language. By embracing the .NET platform and offering seamless C# interop, you could leverage all the libraries AND the awesome power of ML. I got the opportunity to work on a few F# projects, some with the mighty Dr. Harrop, and convinced myself that FP had a lot to offer mainstream software engineering. I was excited about my craft again and started attending some FP conferences and user groups (mainly at Skills Matter).

At the same time, I wanted to see if there were any other “practical” FP languages out there. Naturally, I looked on “the other” big runtime and initially found Scala. I started browsing Odersky’s book, and there were lots of similarities with F#. I was primarily interested in the FP angle (there is certainly lots of clever OO stuff in Scala, which I glossed over at the time) – but there were a few things that bugged me. The lack of “proper” Hindley-Milner type inference was certainly one. I kept looking a bit more and found Clojure.

I was immediately attracted because it was a Lisp, and after some more digging, it turned out to be an extraordinarily well-designed and clean language. Also a very opinionated one: FP and immutability all the way down, and tightly controlled state transitions. Through some of my contacts from previously mentioned user groups, I landed a Clojure gig as a contractor.

When Scala 2.10 was released, my interest (in Scala) was peaked again. The work Typesafe is doing on Async (which is hard on the JVM) and the momentum around Scala is impressive. I’m also an Erlang fan (Armstrong’s dissertation is an eye opener) so Akka is something I want to learn more about. I took the first Scala Coursera course (aced the quizzes thank you very much) and started reading Odersky again (this time the second edition). I really enjoy the power of case classes and pattern matching, and you have to be impressed by the innovation in the OO space that Scala is (in my opinion) spearheading.

I also recently started on a Scheme interpreter in Scala. This has become my standard way of learning a new language, I find a scheme interpreter is just big enough to drill into the guts of the thing. I’m enjoying my Scala implementation quite a bit.