I've decided to pick up
Scala and in order to learn
the language I'm going to do the good old exercise: create a blog. As
always with these things: no, I have absolutely no interest in adding
blog app to this world, nor do I want to create my own blog app that
I'll need to update and do security fixes for. This is purely a learning
exercise and while I'll be posting code and such here, I want to
discourage anyone following this (or reading by accident) from using it
for anything but inspiration.
To gauge the efficiency of this, I'll be doing the same exercise with
Drupal,
CodeIgniter, CakePHP,
Symfony and
ExpressJS for
nodeJS (technically, this will be a learning exercise
on pretty much the same level as with Scala, as I don't know much of
node.js). And before I forget - I'll be using
Lift for Scala for this exercise.
Step 1: install Scala and Lift
I am not entirely sure if installing Lift will also pull down Scala by
itself, or you're required to install it first, but as I want to learn
Scala on it's own, I decided to install it by itself first. That's
fairly easy and done as follows:
cd /opt/
sudo wget https://www.scala-lang.org/downloads/distrib/files/scala-2.9.0.1-installer.jar
sudo java -jar scala-2.9.0.1-installer.jar
This will install the Scala interpreter and compiler (obviously you
should check for an updated jar before forward). It's possible you might
have some paths not set properly and will need to add them manually (in
one installation it worked fine, in another I needed to add
/usr/local/scala/bin/ to my paths.
Installing Lift is just as easy. Download the tarball, untar and then
install:
cd /var/www/
wget https://github.com/lift/lift_24_sbt/tarball/master
tar -zxvvf master
After untar'ing the file, you have the choice of installing one of a
number of different packages. Lift comes with a basic html app, a blank
app, an MVC app and an xhtml app. You can choose to run whichever suits
you better - they have common dependencies and don't install to
anywhere, so there's problem in shopping around between them as you
like. You do, however, need to figure out which one to base your app on.
Whichever you choose, you install it first time round in the following
manner:
cd /path/to/app
./sbt update ~jetty-run
This should pull down whatever dependencies you need and will end up
running a webserver on port 8080, ready for you to point your browser
to. And that's pretty much the end of the software setup :)