Wednesday, July 4, 2012

The next Big Thing?



For a while now I have been very frustrated by the gyrations necessary to try and represent a complex, dynamic hierarchical model of relationships among domain objects using Java. I love what Java brings to the table compared to C and C++ for the kind of work that I do AND it is still insufficient for what I would like to get done.


In effect, I am up against the limits of Java's expressive power when dealing with complex, dynamic relationships. I am spending a great deal of time writing code to make tracking these relationships doable. Recently, I realized that I am writing more code to manage the dynamic relationships and properties of the domain model than any other code in the application. I have started getting many levels deep in indirection in order to try and model some complex relationships. Normally, when I am struggling to express the model in the language I am using, I would try and figure out how to simplify the model. But since the PIM (Personal Information Manager) I am working on is an attempt to express exactly those complex dynamic relationships I would be sacrificing the whole reason for the PIM to exist.


One of the new people at my current company is a Scala enthusiast (rhymes with addict). As a result, I have been looking at this language with some intensity. This is especially true since it appears that the language maps well to modeling the more complex relationships. In other words, it offers the hope of a programming model/paradigm that could drastically simplify what I am trying to do.


Scala combines brevity of expression with numerous and powerful new coding and programming constructs, all built on top of the JVM.


That is the good news.


The bad news is a mixture of a rapidly evolving language combined with old and new documentation intermixed along with a new paradigm (functional programming) to learn and a lack of well behaved, mature tools that costs productivity and time.


I will be writing more about the pros and cons and techniques I am learning in the next few weeks.


The biggest caveat I can give you is that almost all of the IDE integrations for Scala that I have worked with have been rudimentary at best. You should be prepared for a sometimes.
Frustrating user experience when using an IDE with Scala. The productivity gain is still worth the pain and I can't pretend that there isn't some pain involved.


The Eclipse IDE is installed as usual and then you want to install the Scala IDE. You will want to pick the specific plug-in you install very carefully. There are 2 different versions of Scala involved (2.9.2 or 2.10). 2.9.2 is the current stable release of the language and 2.10 is the current bleeding edge. You cannot install both plug-ins in the same eclipse installation. To pick which needs to be installed, go to this website:


Download the latest nightly builds


This page references the nightly builds for the latest version of the Eclipse plug-in (code-named Helium). Believe it or not this is much more stable than the previous versions of the IDE plugin., and the Helium version of the plug-in is available in several combinations:
  • Eclipse 3.7 (Indigo) with Scala 2.9.2
  • Eclipse 3.7 (Indigo) with Scala 2.10
  • Eclipse 4.2 (Juno) with Scala 2.9.2


You will notice that the download page actually lists 4 possible update channels some of which are so messily documented and/or named it's unclear what they're referring to, so I have only listed the 3 that I can be sure of. This is actually a pretty typical situation when dealing with Scala and its tooling.



In order to start learning. I would recommend 1st reading the following to get an overview of how it all relates to Java (This is an invaluable starting point if you are already a Java programmer).


http://www.codecommit.com/blog/scala/roundup-scala-for-java-refugees


Then I would recommend the following books as a starting point:


Programming Scala: Tackle multi-core complexity on the Java Virtual Machine


Programming in Scala , 2nd edition