Sunday, 12 September 2010

Converting Meditation Helper to Scala: Configuring Dev Environment

Now that Meditation Helper is fairly mature, I have decided to do a complete re-write in Scala. There are 2 reasons for doing this:
  1. The current code is a bit messy. Since I was learning how to develop for Android while writing the application, I made some mistakes early on that are making it difficult to add new features in an elegant way. I want to fix those mistakes.
  2. I want to learn Scala.
If it were possible to write Android applications in Clojure, then I would use Clojure. However, it appears that the dynamic nature of Clojure makes it impossible to run on Dalvik, since Dalvik is not Java (despite what Oracle thinks). It seems that Scala does not have this problem. It is a statically typed language that compiles directly to byte code.

I am going to record my progress here. I have no idea how it will turn out.

I intend to create a brand new Android project, then copy across the various resource files (GUI layouts etc). The new version will therefore look exactly the same as the Java version, and will use the same database tables to read from and write to. So the front end and back end will remain the same, with everything in between re-written in Scala.

Once I have a fully working version of the app written in Scala I want to compare the performance and the size of the package.


  • Ok, that's not a great start. I just tried to install the Scala IDE from The installation seemed to go ok, however, it seemed to wipe out the Android plugin! The app wouldn't compile because the builders had disappeared. So, having reverted to a previous version of my .eclipse directory, I will try again by creating a new workspace, and installing the Scala plugins. Then I will switch back to the old workspace and check whether or not the app will compile.
  • The Scala plugin really doesn't seem to want to install. Downloading Eclipse Classic 3.5.2 to try with a fresh Eclipse installation.
  • That seemed to work. To be fair it does say at that Eclipse Classic is a requirement. I was running one of the other Eclipse builds - Eclipse for Java developers I think. Now to re-install the Android plugin.
  • Had to add to the list of update sites in Eclipse in order to resolve the Android dependencies. And even then it still doesn't work. Now neither Scala or Android appear to be available. This is turning into a yak shaving exercise.
  • Woo hoo! I had the wrong version of Eclipse classic - 3.5.0 instead of 3.5.2. 
So in summary, to have Scala and Android pluging in the same IDE I needed to:
  • Install Eclipse Classic 3.5.2
  • Add to the list of available download sites
  • Add to the list of available download sites and install the Scala IDE
  • Add and install the Android plugins.
I hope things go more smoothly from now on...

No comments:

Post a Comment