The Artima Developer Community
Sponsored Link

Small is Beautiful
Scala
by Cees de Groot
June 15, 2009
Summary
I've seen the next big JVM language, and it's called Scala.

Advertisement

Ever since I started working with Java, I had the same nag - the whole idea behind the JVM, packaging, et cetera is sound, but for a mid-90's programming language I would have wished that the designers put more burden on themselves and less on the user. Compilers at that time were doing funky stuff in terms of optimization (I remember the first time I analyzed the output of the MIPS C compiler), so there were plenty of compute cycles available to take work from the developer by making the compiler smart.

For the first really big project I did in Java, we quickly decided that we needed some aid and added JPython into the mix. Code generation in JPython was a breeze compared to doing cumbersome string manipulation in Java, but we left it at that because performance simply was not good enough. Ever since, I've been looking for something to complement or even replace Java, but so far the languages were either dynamically typed (and thus slow on the JVM), or very esoteric. Neither was, to me, a good option (I always seem to end up with projects that have high performance requirements ;-)).

Enter Scala. It's been a long time since I was so enthusiastic about a programming language (and this from a guy who had "learn a new language every year" as a motto for a very long time). It's not dynamic, but it's got the next best or even better thing: type inference. Basically, it's a language where the compiler takes all the burden of annotating variables, functions, etcetera away from the developer - usually it is smart enough to deduct this stuff by itself, which makes code just as concise as code in your favorite dynamically typed language, but with all the good stuff that static typing brings you: precise code completion in the IDE, robust refactoring, and not having to write unit tests that basically do type checking.

Furthermore, Scala is not just an OO language, it also supports the functional paradigm. One of the major annoyances in Java (especially when used to Smalltalk) is that you cannot simply pass around bits of code as first class citizens, and where you can the syntax usually makes stuff so unreadable that reverting to an imperative style usually is the better solution. Scala lets you pick and choose between OO and functional in a way that I, at least, never have seen in a language that has all the promises to go mainstream.

So why do I think Scala can go mainstream, then? It is a brilliantly designed language, and it is very accessible to Java developers (who can basically start out by doing pretty much what they're used to do but with way less typing). It has a very thorough book that explains the language (available somewhere here on the site ;-)), and it has IDE integrations in the three major IDEs. Also, by virtue of being statically typed, it will compile for most cases to straight Java byte code, so expect your programs to be pretty fast even for very demanding environments. Seems there's hardly any downside, then, just pluses...

This article basically is a promise to vote with my feet - the coming year, I'll hack Scala for my open source work, my side projects, and whatnot (hopefully my daytime job will follow), and I'll report back whether me as a seasoned Scala developer still has the same enthusiasm as me as a seasoned, errr..., Scala book reader.

Yup - you read me right. All this stuff above is mostly theoretical. Even though I've programmed (for food) in countless languages and I think I'm a pretty good judge about what will work and what won't, my judgment about any pudding is usually deferred until I ate it. Basically what I'm doing here is boring you with non-information about perceived benefits, sticking my neck out in public for a language that I just feel to be great (and just what I've been looking for since, say, 1997). So far, my "Hello, world" level work seems to support my expectations.

Wath this space for my confrontations with reality...

Talk Back!

Have an opinion? Readers have already posted 14 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Cees de Groot adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Cees de Groot is currently working as team lead for eBay on one of the worlds largest classified sites. Cees brings 20 years of experience in a variety of industries, languages and positions. He was one of the earliest-adopters of Java, equally vocal and present in the Jini and Smalltalk communities, and has decided a long time ago that he's too lazy to understand complex systems. Therefore, he sticks to simple stuff resulting in a bookshelf full of works on agile development and no-nonsense OO techniques.

This weblog entry is Copyright © 2009 Cees de Groot. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use