Roundup: Scala for Java Refugees

来源:百度文库 编辑:神马文学网 时间:2024/05/03 00:09:18

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 del.icio.us 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.

  • Part 1: main(String[])

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

  • Part 2: Basic OOP

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).

  • Part 3: Methods and Statics

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.

  • Part 4: Pattern Matching and Exceptions

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!

  • Part 5: Traits and Types

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.

  • Part 6: Getting Over Java
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.