This is not a tutorial*

* Well it kind of is. I wanted to learn how to program in scala, with pretty much zero knowledge. I wanted to use test driven development from the start. I know how to program, just not scala. This isn't a how to code scala guide, just a how to get started. I'll talk you through getting a build tool and setting up an ide, and getting some tests working. Once you get started, go soewhere else to learn how to do it well! These are just my ramblings as to how to get started.

I'm using Linux Mint 17 to do this, but any flavour of Ubuntu should be similar.

Hello World

A cliche, but what respectable programmer doesn't start with this.

Get the scala build tool.

echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt

Now create a folder to work in

Frm this point I pretty much followed this tutorial but here's a summary of what's involved.

mkdir -p src/scala/hello
cd src/scala/hello
echo 'object HelloWorld { def main(args: Array[String]) = println("Hello World!") }' > helloWorld.scala
sbt run

The sbt will download the a bunch of required packages the first time you run this command, which may take a while, these will be cached in the ~/.sbt folder. Subsequent runs should be instantaneous.

Getting org.scala-sbt sbt 0.13.9 ...
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.9/jars/sbt.jar ...
[SUCCESSFUL ] org.scala-sbt#sbt;0.13.9!sbt.jar (1896ms)
downloading https://jcenter.bintray.com/org/scala-lang/scala-library/2.10.5/scala-library-2.10.5.jar ...
[SUCCESSFUL ] org.scala-lang#scala-library;2.10.5!scala-library.jar (4631ms)

... etc

and you should then see the reults of your labour.

Hello World

amazing! Now you can go on to writing some tests