Programming

Baby steps in Scala

Okay so following on from the User Group meeting I have started the exercise of porting a Java application to Scala. I’ve chosen Jay’s Secure Diary (or just JDiary for short) and I have commited some code to Launchpad.

So then, learnings so far… Well this is all being done via the command-line and a text editor as I have the Eclipse plugin has just not wanted to play ball with me. It’s also a tremendous pain in the ass to get stable updates of the plugin. I’m getting support from the Scala Tools forum but it feels a curious mix of features. A lot of things are very polished but the basic behaviour isn’t solid.

I was mightly relieved when I got Gant working and taking some of the strain of the build. It is surprisingly easy to get going. I based mine on this blog post. The harder part is referencing the Scala Home Directory which I have hardcoded for now and need to sort out.

I also gave Scala GUI a go but gave up quite quickly because it seems very opinionated about how you should be doing guis and while I like some of the ideas it didn’t allow me to use any of my existing Swing knowledge and didn’t have any easy documentation for how you are supposed to use it. In Profligacy for JRuby and Groovy you are allowed to mix the two approaches a lot more freely.

I also spent a ridiculous amount of time trying to implement the ActionListener trait/interface until I hit on the fact I was meant to be using the override key word. The compiler error complains that the parameter (ActionEvent in this case) is not defined, that’s true but it’s really not helping you understand what is wrong with the code.

I also spent too long fiddling around with Launchpad, but that’s another story for another post.

After investing eight hours or so in the effort I can be happy that my code is looking relatively clean compared to the original but I have to say that I was enjoying Scala more when I was sticking to just Scala.

Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s