My plan was to save myself a lot of headache involving the silly amount of list and coordinate manipulation I was starting to do, and switch to Scala. Great idea, things are now moving pretty quickly. However, the decision came with some serious side effects. First, Scala takes a long time to compile. Type inferencing comes at a cost, and the compiler has to make two separate sweeps to make sure it conforms with Java type erasures as well. Scala’s platform contains a lot of classes, all of which must be loaded into the class loader at runtime. The potential savings gained from having fewer lines of code somewhat offsets this, but I found that compiles were taking an unacceptably long time to run a continuous build.
Searching for good ways to perform unit testing in Scala led me to ScalaTest, and upon installing it I realized I needed to upgrade from Scala 2.8.x to 2.9.x, so I did that. Or tried to. Strange “file not found” compiler errors led me to the discovery that Scala 2.9 doesn’t run on IntelliJ IDEA prior to version 10.5, so I ended up gutting and reinstalling IDEA from scratch as well.
Once I got through that minefield and got my simple tests running, I started digging into setting up the Fast Scala Compiler (fsc) server to run in the background. I’ve had very limited success with this. In order to actually get it running I had to configure it in IntelliJ, then run it, copy the line from the run dialogue window into Terminal, un-b0rk some of the whitespace in the command, and run the server from the command line.
For a long time I struggled against this, without success. Eventually I took a break, took a walk, went to the local cupcake shop and contemplated the matter while scarfing down a pineapple upside down cupcake. When I came back, I dug some more and found a more straightforward thread about setting up fsc in IntelliJ IDEA. Nick’s description of the process gave me an idea.
I took out the port number from the fsc configuration screen and it. Just. Worked.
So, now I’m happily using the fast scala compiler, running my build every 30 seconds or so, cranking out unit tests to define my core logic behavior, and rapidly catching up to my last Java milestone.