Justin du Coeur (jducoeur) wrote,
Justin du Coeur
jducoeur

Scala By Example

For serious programmers: I've been gradually reading into the language Scala for the past few weeks. Having just finished the online book Scala by Example (PDF, about 150 pages), I commend it as a fine read, for language geeks or simply programmers who want to expand their repertoire in useful ways. It's one of the better languages books I've come across.

It's written by programmers for programmers -- anyone who doesn't have pretty good depth in the subject will just be left at sea. But if you're an experienced software engineer, it's a neat read. Rather than trying to be orderly and complete, it instead presents a series of chapters, each introducing a major concept in Scala with relatively rich examples. It doesn't waste time on the basics: most chapters are focused on things that are really different from conventional languages like Java or C#.

It's gone a long ways towards convincing me that I want to migrate much of my development over to Scala. My original motivation had simply been the desperate crying need for a functional language -- I use functional techniques a *lot*, and emulating functional programming in Java is an awkward and bulky pain in the ass. But in practice, I find myself very attracted to a lot of Scala's other capabilities. For example, it rather casually (in Chapter 3) describes Scala's capabilities for working with Actors and Messages -- essentially, by adding a single library, it gains the core functionality of Erlang, while not being as irritating and limited a language as Erlang. Given that I'm increasingly suspecting that the Erlang-oid message-passing approach is probably the way CommYou *should* work internally, this is very tempting, and I may start experimenting with it.

Better yet, the book drives home the language's meta-programming facilities. A lot of the examples are of the form, "Here's a useful language feature -- and here's the code that implements it". Indeed, the book ends by returning to its start, building up from a few synchronization primitives to demonstrate how to implement a simplified version of the Actor functionality.

I'm quite taken by the whole thing: Scala looks to be a very good language. It has Ruby's intense object-orientation, without Ruby's syntactic quirks and weak threading. It has Erlang's message-passing, without Erlang's lack of OO. It has more or less complete interoperability with Java (within reasonable limits: if you define classes that go beyond Java's semantics, you may not be able to access them), and access to Java's full libraries, but adds all the things that Java is lacking such as functional programming.

So I'm going to investigate it more seriously: I'll try installing it and migrating some CommYou systems over to it. More reports on that as it goes...
Tags: programming
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 13 comments