I think Scala may be a gateway drug

As I have been trying to learn more about Scala, there have been several paths that I’ve had to follow. One is getting acquainted with the state of Java development, since ultimately Scala exists within the Java ecosystem. Another is finding my way around the Scala libraries, tools, and idioms. But there is a third that seems to be somewhat deeper, and that is coming to grips with the functional nature of the language. ...

24 January 2012 · 4 min

Making the Climb Part 4–Pattern Matching

Continuing our journey down the path from the familiar to the down-right bizarre, we find ourselves at Pattern Matching. This is a feature of the Scala language that shows it’s functional side in a strong way. Pattern Matching is a fundamental part of functional languages in general, and provides a way to write very concise and expressive code. On the surface, pattern matching in Scala looks an awful lot like switch statements in C# (and Java for that matter), but you shouldn’t cling too hard to that association. ...

22 January 2012 · 7 min

Making the Climb Part 3 - Generics of a Higher Kind

This is part 3 in a series. If you’ve not followed-along so far, you may want to check out Part 1 and Part 2 first. It’s time to start digging in to some of the crazy-goodness that makes Scala such a glorious and wonderful thing. First things first, though, we have to talk a little bit about this history of Generics in Java and the JVM. Type Erasure and you… Back around the time that .Net was adding support for generics, the folks in Java land were doing the same…sort of. The biggest difference between the way Generics were implemented in .Net and Java is the fact that in .Net generics are supported directly in the CLR (sometimes called reified generics), whereas the JVM did not include direct support for generics. Ok, so what does that actually mean? Well, for starters it means that when you’re dealing with Generics in Java you run into Type Erasure. Type Erasure means that when Java code with generics are compiled, the generic type information is removed at compile time, so while you’re looking at an ArrayList in Java, the JVM sees this as just an ArrayList, and things get cast as needed. There are a couple of types which get reified into actual types (Arrays are the best example), but for the most part this doesn’t happen. In contrast in the .Net world a List gets compiled into a List`1<System.String> which is a real type at the IL level. Now, I’m not going to get into the argument about whether or not type erasure is good or bad, but it is a fundamental difference between the two platforms. ...

5 October 2011 · 8 min