Skip to content

Roundup: Scala for Java Refugees


To be honest, I’m somewhat kicking myself for writing this post.  As I’ve said many times: roundup posts are for people who are too lazy to write real content.  I can’t tell you how many blogs I’ve come across which have a roundup-to-post ratio of easily 3:1.  You know it’s a bad sign when sites start having roundups of their roundups…

Meta-roundups aside, I decided (after much deliberation) that a single post linking to all six parts of the series would be useful to one or two people.  So if you like to save things with or even plain-old-bookmarks (POBMs for short), this is the one!  And if no one finds it useful, eh, I suppose Google probably likes it. 

Of course it’s always possible that you subscribe to my way of looking at things.  If you hate roundups as much as I do, skip this article and go read something useful.

Introductory article giving motivation for learning Scala and some first steps to “get your feet wet” in the language.

Looking at Scala’s syntax in a little more detail.  Properties, variables, methods, classes and constructors all find their home here.  We also touch on Scala’s import statement (which is a vast improvement over Java’s).

Scala’s method syntax is far too powerful to cover in a single post.  Part 3 goes into more detail, as well as introducing the concept of the singleton object and explaining how Scala really doesn’t have statics at all.

Pattern matching is one of the most useful constructs in the entire language.  Having a good understanding of it is critical to utilizing Scala to its full potential.  This article covers some basic pattern matching, case classes and a bit of exception handling.  There are a lot of very interesting comments on this post, so be sure to scroll all the way down!

Getting further away from perfect parity with Java, this article looks at traits (Scala’s more powerful substitute for interfaces) and just skims the surface of type theory applicability in Scala.

This article throws caution to the wind and picks up all the fun, Scala-specific topics I didn’t cover throughout the rest of the series (such as functionals, implicit type conversions, symbolic method names, etc).  This is my favorite of the series, simply because it covered many of the really interesting topics.


  1. For people interested in Scala, it is nice to be able to send them only one link!

    Kieron Wilkinson Wednesday, February 13, 2008 at 6:22 am
  2. Îf scala cut back on some features that are only going to cause it pain, like operator overloading and the 2 types of class and inheritance (i’d prefer a global mechanism of delegation over interfaces – or traits), it would be even better.

    duh Wednesday, February 13, 2008 at 6:43 am
  3. Returning more than one value is also highly suspect to me. Say no to easy tuples…

    duh Wednesday, February 13, 2008 at 6:47 am
  4. Just wanna say thanks for putting these tutorials up… they’ve been immensely useful!

    James Carr Wednesday, February 13, 2008 at 11:06 am
  5. Thanks for your articles. Great work!

    Mike Wednesday, February 13, 2008 at 1:10 pm
  6. Hi,

    It’s been two weeks that Scala is driving me crazy..
    I’ve read tutorials over & over, but I don’t know, it didn’t worked…

    Then, I lost myself on your blog, read your description, and shout to myself ‘ Damn, it’s me!’
    Well, I’m not exactly an experimented or expert Java developper, but I feel comfortable with Java…
    I prefer Python, but, when you’re a young developper, you use what the boss says…

    Actually, I’m french, and the reason why I leave a comment is that there is no good french tutorial on Scala ( or it’s well hidden )..
    And I wanted to ask you, if I could translate your articles to french..
    It’ll definitevely not be a perfect translation, neither a reference on Scala, but it could be useful for some french devs, and most of all, it’ll be a good chance for me to dive more deeper in scala..
    Anyway, the choice is yours, and it’s more pedagogical ( word is correct? ) for me than anything else…

    Oh, I’ve almost forgot to thank you for these articles… I was sceptical about Scala, but now, I have a better feeling with it…

    Thanks again


    Aykut Acikel Monday, February 18, 2008 at 3:57 pm
  7. Have at it! :-) I distribute my content under Creative Commons, which basically allows efforts like translation as long as the republication is also licensed CC.

    It would be absolutely great to have a french translation of these articles. If you think it’s worth your time, I’ll happily link to the result from this roundup.

    Daniel Spiewak Monday, February 18, 2008 at 4:03 pm
  8. Great!

    Well, I’ll work on it …

    I’ll keep you informed of the translation ..

    Aykut Acikel Monday, February 18, 2008 at 4:24 pm
  9. Also, great articles! Just FYI I read them while going on a bus tour of the Great Ocean road in Australia on my Nokia cell phone’s tiny screen – that’s how good they are! ;)

    So after learning a bit of Scala from your posts, as you know, I gave it a go:

    Thanks for your comment btw!

    Antony Stubbs Friday, February 22, 2008 at 5:49 pm
  10. Great tutorials. Thanks!

    Tomas Varsavsky Saturday, March 8, 2008 at 11:12 pm
  11. I have seen how to use existing Java lib in Scala. My problem is the other way around – How to leverage Scala in Java. I already have a large Java application. I would like to use Scala to develop a DSL for others to use to extend my Java app’s functionality. Can you point me to the right place for samples or info.

    Thank in advance.

    Mike Friday, March 28, 2008 at 8:51 am
  12. There’s almost nothing out there regarding best-practice scenarios for using Scala in a Java project. Though, there are a few more options if you’re looking for information on DSLs in Scala. If I may be shamelessly self-promoting: :-)

    Daniel Spiewak Friday, March 28, 2008 at 9:10 am
  13. If you don’t mind, I would like to translate these articles into chinese as that french body.. Thanks.

    aaron Monday, June 2, 2008 at 2:38 am
  14. Go right ahead! :-)

    Daniel Spiewak Monday, June 2, 2008 at 9:34 am
  15. A pdf would be great.

    mohbana Friday, June 6, 2008 at 9:18 am
  16. Not a bad idea! Seems it’s time to break out the ol’ HTML-to-LaTeX converter…

    Daniel Spiewak Friday, June 6, 2008 at 11:04 am
  17. @mike – chapter 29 of the artima scala book is about java/scala interop. aside of that, you’d have to sift through scala mailing list.

    @duh – (1) you can think of “case” class as syntactic sugar for allowing the concept of algebraic data types and deconstruction required for fp matching. google the paper, then the light will come on. (2) multiple return types – supsect? your logic makes no sense. if you’ve ever returned an object, then you’ve likely returned a type with multiple values emboldened within it. don’t let scala’s new way of looking at things scare you. the research to combine fp and OO behind scala is solid.

    jherber Sunday, August 10, 2008 at 2:07 pm
  18. good article..very useful to me…thanks a lot

    mugi Sunday, September 7, 2008 at 9:44 am
  19. I want to say thank you for write this article…Scala’s method syntax really make too power full

    mugi Sunday, September 7, 2008 at 9:47 am
  20. Great articles! Highly accessible even for non-native speakers and provides a very gentle transition from Java to Scala. /me likes. :)

    Henrik Horneber Wednesday, February 18, 2009 at 9:39 am
  21. I enjoy reading your scala tutorials. And yes I do like the roundup!

    Torsten Uhlmann Monday, April 5, 2010 at 7:57 am
  22. hi…
    thx for the great article…
    its very basic.. its help me a lot..
    but i want to ask you about Polymorphism..
    did you have an article about it??

    vahndee Saturday, July 24, 2010 at 9:54 pm
  23. I am planning to use continuation support in the scala language through shift and reset to track the users who are logged in(We are trying to use this instead of using session or cookie to track the users logged in). So please provide us any sample programe to implement the continuation support through shift and reset to track the logged users in scala.

    monisa Friday, March 25, 2011 at 6:07 am

Post a Comment

Comments are automatically formatted. Markup are either stripped or will cause large blocks of text to be eaten, depending on the phase of the moon. Code snippets should be wrapped in <pre>...</pre> tags. Indentation within pre tags will be preserved, and most instances of "<" and ">" will work without a problem.

Please note that first-time commenters are moderated, so don't panic if your comment doesn't appear immediately.