Nabaztag Scala Library
A few months ago, I have submited to google code a library written in Scala which send simple commands to a Nabaztag.
The library is pretty alpha, I’m not fluent in Scala yet. So they is probably a lot of things to refactor.
The library is build using maven-scala-plugin, you should be setup in a few seconds.
I was pretty happy of the library until I tried to used it from the java side, and feel the horror. I especially thought that they were some kind of “conversion” between common java type like an ArrayList into the equivalent in Scala. There is not, I was forced to use a Scala List from the java side…
After discussing it with scala fans there is two suggestions, avoid exposing raw Scala List and provides method to add, delete etc… or provide a Java interface binding nicely to the scala code.
I have not choosen yet which way to go.
This library is currently used daily during our daily build, it’s part of a TeamCity plugin sending commands to the nabaztag when something bad happen to our product build lines.
I may give away the corresponding teamcity plugin if time permits.
It especially good now, that the rabbit is saved ( in French )
Link :
Fanf:
Hey, happy to know that there are other OSSGTP Scala fans
For your problem of Java interfacing, I would say that the “Java interface binding” is the better way to go.
I tried the other way around, and you end missing a lot of Scala-ism due to the mix with Java-fashion in the Scala part. Moreover, in Scala 2.8, scala.collection.JavaConversions really help in converting between Java and Scala collections (and so, a slim Java binding interface is not too painful to build).
And finally, the Scala list is a pure functional structure: nearer to Java ArrayList is Scala 2.8 Buffer.
See you next time around a beer
9 November 2009, 10:48 pm@sadache:
The issue is much simpler than this. Imagine any library writer that uses internally other date type than Java’s broken Date (JodaTime for instance): If he doesn’t wrap it back into Java broken Date then you have no choice but to download and use JodaTime apis, period.
It is a design issue and by no way a Scala problem. In your Scala code you could just use the available Java List but you won’t since it is really less interesting.
The call is difinitively yours
13 November 2009, 12:22 pm