views:

3945

answers:

2

I'm trying to learn Scala, and I'd like to learn by writing a simple swing app, but I'm unsure what GUI programing looks like in a functional world, and specifically when using Scala. Any pointers, or tutorials, or gotchas when coming from an OO/Java background would be really welcome.

+8  A: 

The Programming in Scala book did contain an overview of the scala-swing project. The book is very good, overall, and worth the money as a general reference, and sounds just like what you're looking for.

Scala-swing is a "wrapping" library approach, so, I wouldn't call it functional, really. State is mutated all over the place, mostly because that's just how Swing works.

I'm not really aware of many "free as in beer" resources for this topic yet, and I think the Syngeca scala wiki probably lists some preliminary approaches that became scala-swing, but, that's just a guess. :)

Tristan Juricek
+5  A: 

The only functional paradigm of GUI programming I know of is Lisp's Cells.

Scala's present Swing library is reactive, which isn't bad. It's being reworked for version 2.8, I have heard.

There are, though, alternative frameworks. One recent one, for instance, is a Scala wrapper for SWT.

I think that, at this point, there hasn't been enough projects done for any particular pattern to emerge as a superior choice. I'd advise taking a look at everything out there, and choosing one that fits you better. Who knows? You might even become a major contributor to the best Scala GUI framework that comes to be...

Daniel