Friday, July 23, 2010

using sbt to setup a project

Following up the earlier Scala post, now that I've actually had a chance to try sbt and talk to others about using it.
Following the instruction here: sbt-setup
you don't even need to install Scala - it evaluates dependencies and installs it for you. That's nice and just what you'd expect it to be capable of!

That said, I'm not yet convinced it will work well with existing Maven repositories, as it has its own lib_managed directory too.
Because it's Ivy-based, it also does not work directly with Maven plug-ins.
But you can start with a POM and it will build and run it.
The Scala interpreter allows direct access to the Spring context.
I'm told that if using Scala 2.8.0 you can work correctly with the nested annotations in a Hibernate-JPA project, but I haven't seen this actually happen yet.

In short, I think its probably still not a seamless integration into a legacy project, but it does appear that it could be used to integrate with and provide a new way to build a project with existing code. Further experimentation remains.

Tuesday, July 20, 2010

Scala Summit @ OSCON 2010

I attended the Scala Summit at OSCON this year. I have worked with Scala off and on in the past year, but have never really used it on any substantial project.
There were several presentations throughout the day, here is a quick rundown on what I saw:

Akka framework, providing support for concurrency, fault-tolerance, and STM. To me this was the most interesting presentation, in part because I think Scala provides great promise for building concurrent applications more safely. This framework borrows concurrency and fault-tolerance ideas from Erlang, using message-passing between lightweight event-based actors, allowing for thousands of such concurrent actors. It claims to be much more performant than the default Scala concurrency libraries.
more here: akka

sbt - the Simple Build Tool, is clearly the tool of choice to manage the Scala/Java build process. It incorporates dependency management using Ivy, allows for build programs to be written in Scala. It looks useful as a general replacement for other build tools as well. simple-build-tool/

Specs - a domain-specific language for creating specifications and validating code against it.
see more here: specs

Lift framework: another presentation on Lift that, I think, suffered from the presenter doing live code instead of working from slides. There was some interesting discussion of the benefits of static-typing in such a web framework (a bit less testing required for example.) The other thing I came away from this with was how powerful the Comet library is, looking forward to diving into this further.

Android/Scala integration - some discussion on toolchain, problems with larger libraries, and the role of type-safety.

Scala in Practice: developers from Twitter and ??? ran a Q&A session. A couple of things that echoed my experience was the difficulty of integrating new Scala development into existing Eclipse & Maven toolchains. Also, remember you're not writing Ruby on Rails, or Java - don't just bring the same idioms. These folks also gave up on the standard concurrency libraries due to performance, rolling their own (Akka wasn't yet available, but they said they would use it now.)
The other thing that really rang with me was that, rather than trying to introduce Scala in a low-risk "test" project, it would be better to write something important. (At least it worked for them!)
There was also some discussion about lack of support for nested annotations and how this affects persistence frameworks - something I need to look into more.

Advanced Scala Language Features - last session of the day, some of which was over my head as a Scala newbie.
The two concepts I took away was the notion of "higher kinds" and continuations.
Kinds are a level above types (Kind systems classify Types, Type systems classify Values.) They allow you to construct and manipulate Types.
Continuations are a feature common in a few other languages, Scala 2.8 has a form that the speaker argued was not really that useful. Remains to be seen

I also had some offline discussions with people about integrating Java and Scala. All thought it was great, but also warned me that the Eclipse 3.5/Scala 2.7 integration was a bit brittle. So at least it wasn't just me having the problems!
All swore by the 'sbt' tool. I hope to get a chance to new Eclipse and Scala 2.8 soon and see if its better to integrate. i'm also looking forward to digging into the Akka framework.