January 3rd, 2009

device

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

Yeah, I didn't need that knee anyway...

The happy part first: going bowling with friends is an annual treat. I don't do it much, but Kobi's birthday provides a fine excuse, as well as a chance to see lots of folks. I wound up playing with hungrytiger and isisofcool (as well as with Peter the Red) -- the main upshot of that game was realizing that their four-year-old daughter Michelle is a ringer, who really should be put into some sort of bowling-prodigy program. She would kind of hurl the ball down the court, sometimes in the right direction, sometimes into the bumpers (which were nominally up for her benefit, although the grown-ups needed them just as much). Regardless of which way she tossed it, the ball consistently made its way, Very Very Very Slowly, right to the center pin. It was magnificent to watch, a sort of Zen Bowling, and she tied me with a 70. (For a while, she was leading the group.)

I later played another set, and demonstrated that I get exactly the same score without the bumpers as I do with them. I wish I could say that that was because I didn't gain anything from the bumpers in the first game.

The only downside to all of this is my... well, let's say "unique"... bowling style. I can only bowl straight if my follow-through is good, and I only get good follow-through if my body is low. Very low. Like, with my eyes at around the level of the top of the pins.

The result -- well, those who attend dance practice regularly will know Rule Number 1 of the Riverenza: "Do Not Thump Your Knee on the Floor. Thumping Is Bad." I have completely failed to observe that rule myself today. Every single ball ended with a Thump. Mind, it was often a Thump that resulted in very good follow-through. But it's probably a good thing I don't do this more often...