"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)

Saturday, 15 November 2014

The quest for new languages: Scala

As a programmer I try to keep track of the new tools are continuously made available to my work. It's a hard task, almost impossible, since every day new languages, framework or libraries are proposed on the Internet. I usually follow a conservative strategy by leaving novelties to “grown up” a little in order to see it they are more or less widely used.
I've been recently reading this article, among the many languages and technologies cited one particularly awakened my interest: Scala.

Why Scala?

Three things about Scala caught at my attention: first it runs on a standard Java virtual machine this means an easier integration with the programming ecosystem I'm mostly used to work with. Then I learned that Scala implements the functional programming paradigm. I really know little about functional programming but the idea of learning a new programming paradigm really enticed me. Last, but not least, Scala is nowadays widely used in big and complex software projects like Twitter or LinkedIn.

Scala on Eclipse (Luna)

A good Eclipse plug-in is available for Scala named Scala IDE for Eclipse. I fist tried downloading the one available at Eclipse Marketplace but I soon discovered it didn't work with Eclipse Luna. After some searching in the Internet I discovered the only working version for Eclipse Luna is version 4.0 release candidate 2. Installing the plug-in has been only matter of copying the update address into Eclipse “Install new software” window, agreeing to licenses and following instructions.

Scala on Netbeans 8

Also installing Scala on Netbeans (and the EEEPC) has been a bit tricky. Following instructions from here I First installed all available Scala plug-ins from Netbeans plug-in manager

Then I downloaded Scala binaries from here and extracted them into the the “/opt” folder
I then added Scala paths to environment variables by editing “.profile” file and adding the following
if [ -d "/opt/scala-2.10.4/bin" ] ; then
I also added Scala path to “nedbeans-default-options” section in “netbeans.conf” file
netbeans_default_options="-J-Dscala.home=/opt/scala-2.10.4/ -J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"
Last, once started Netbeans, I had to set Java 7 as the project virtual machine since, for the Scala version I downloaded, Java 8 JVM doesn't seem to work.
At last here is my first hello-world on Netbeans