?

Log in

No account? Create an account
Previous Entry Share Next Entry
A couple of ways into the Uber-Fancy parts of Scala
device
jducoeur
[For hardcore programmers only. Seriously: this is the stuff that pushes right at the bounds of my comprehension.]

This has been a good week for good explanations. It started on one of the Scala mailing lists, where one of the users was bemoaning the difficulty of trying to figure out what the heck continuations are and how to use them. For once, he got good pointers.

First up is the video Monadologie -- a concise but mind-blowingly useful little one-hour lecture. In about half an hour each, it describes what continuations are and why you might want to use them, and then what monads are and why you definitely want to use them. They're still advanced concepts, mind, and if you're coming into this cold you shouldn't expect to instantly internalize them. But it provides great handles on why you want to use continuations (to build complete control structures that are easy to use) and monads (to more easily compose dataflow), and gives a sense of how each tool works. Even if you aren't using Scala yet, the video is worth watching, since the concepts in it are becoming gradually more common nowadays.

Second, the conversation finally convinced me to buy Scala for the Impatient. Seriously: every hardcore programmer should read this book. It is exactly the book I've been looking for. It assumes that you already know at least one major OO language like Java or C#, and that you don't need explanations of things like functions, classes and stuff like that. Instead, it leaps right to the meat of the question, "What's different about Scala?". It's structured around the Scala Levels (a useful categorization of experience levels that Martin Odersky came up with a year or two ago), starting with the basics that everyone should know and gradually moving up to the incredibly sophisticated but powerful features. (With delimited continuations coming at the very end.)

The book is available in several forms, including Kindle (which is how I bought it), printed or other ebook. The early chapters have been made available for free from Typesafe (the consulting company that consists of many of the movers and shakers in Scala), and are well worth reading. I've been saying for several years now that Scala is the current best language on the block -- this is the book that demonstrates why, with sections relevant to the daily work of any programmer...

  • 1
I don't know if you saw it but Martin Odersky is teaching a class on Scala at Coursera. I am not signed up for that one, but I am taking a class on writing. Also my Step Daughter is signed up for intro to programming in python.

I'd sort of vaguely heard about it, but hadn't looked it up before. Here it is: looks like it's really a course in practical functional programming rather than Scala per se, although I'm sure he has an agenda of teaching Scala along the way.

It looks interesting, but I suspect it'll a bit too slow for me: I've been using functional techniques very heavily in C# and Ruby for a good ten years now, and played enough with Haskell to have the grounding pretty thoroughly. It's just the really advanced stuff that I'm still struggling with, and I suspect that that will be covered at the end of the course, if at all.

(Truth is, I've even gotten to the point where I'm starting to "get" monads -- the Monadologie lecture mostly drove home what I'd already figured out. The timing is excellent, since I'm starting to conclude that QL -- the new programming language I'm designing for Querki -- wants to be *so* monadic that it doesn't even bother using the term. For certain domains, monads are just necessary to DWIM nicely, and this is one of them.)

So I suspect it's a damned useful course for many people (and some of my readers here may want to check it out), but probably isn't quite worth the time investment for me. A great course in the scalaz library (Scala's truly hardcore functional-programming library) would be a different matter, but I don't think this goes that far.

I would love to see some coursera classes aimed at those of us who have been programming for 15-20+ years. That being said a lot of what they do offer looks great and I plan to take advantage of them over the next few years.

I have been using functional ideas also for a long time, in Javascript and now CoffeeScript, as well as Erlang and bits of Lisp over the years.

Oooh tell me about your new language, I want to know what you come up with

I'll post about it when and if we decide to go forward to with Querki (at which point, I'll start posting a *lot*). Hopefully a week or two.

Suffice it to say, it's a DSL aimed specifically at the sort of data transformations that seem to be most useful in the Querki environment, where you have a lot of objects pointing to other objects, and you want to mainly do queries that collect and summarize those, slicing and dicing them in various ways. Very pipeline-oriented and deliberately simple.

  • 1