Friday, 9 March 2012

Scala Dojo 01 - The MailBox


This inaugural dojo challenge should ease you into Scala gently, with the solution only requiring you to write about 6 lines of code. On the way you'll get Scala and Git running on your machine, hopefully set up a GitHub account, started to become familiar with the Scala syntax, patten matching and the ScalaTest framework.

Go here to see an overiew of this series of Scala dojos

The Mailbox problem

This problem involves completing the implementation of the MailBox.scala class, with the rules of how it should respond to different messages expressed in the tests. There is one rule in Dojo Club, get the tests to go greenThe skeleton maven project I have created for the dojo can be found here on github. Though you should not change the existing tests feel free to add new tests along the way.

Getting the code

To get started you can fork the project into your own github repository, this is the preferred method as it means we can easily share our solutions with each other. If you don't wish to do this you can create a local copy from my repository by simply executing the following command.
git clone

Getting started with git

If you dont have git currently installed you can download it here from the git website. When using Git I found this one page cheat sheet useful, it also comes with some pointers about good VCS practice, Git_Cheat_Sheet_grey.pdf




  1. Hey, thanks for this! However, I am quite confused about how to use Scala Build Tool or Apache Maven. It looks like you provide both an SBT and a POM. Which one do we use? Do they operate in concert? I'm unfamiliar with these tools and would appreciate a primer or a pointer to some resources. Thanks again!

    1. Feel free to use either, they both allow you to build the project and run the rests so it down to personal preference. Maven is included as its usage is widespread in Java developments, whereas for Scala the Simple Build Tool is the norm.

      If using an IDE like Intellij, with the Scala plugin installed, you can simply select the 'open project' option and open the pom file to get started.

      If you want to work with SBT you can find out how to install and use it on its GitHub page here -