Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aidanwhiteley/scala_impatient

Some possible solutions to the exercises in Cay Horstmann's Scala For The Impatient (by a Java programmer learning Scala)
https://github.com/aidanwhiteley/scala_impatient

Last synced: 14 days ago
JSON representation

Some possible solutions to the exercises in Cay Horstmann's Scala For The Impatient (by a Java programmer learning Scala)

Awesome Lists containing this project

README

        

Project Details


Scala For The Impatient Exercises


This repository contains some sample solutions to the exercises in Cay Hortsmann's book
Scala For The Impatient.



Like everything else, it is a work in progress. It contains progress to date noting that
I haven't spent the time to create solutions for those exercises that either:



  • don't really interest me - e.g. exercises for the chapters on packages and annotations

  • exercises that don't readily allow test driven development - e.g. those that just want output printed to the console (albeit I've converted many of these to return testable Strings)


Is it any good?



Is the code in the solutions any good? I very much doubt it! As a long term Java user (and previous user of many other imperative languages), I know that I
haven't really got the many of the Scala idioms "down" yet. It is worth mentioning that despite having just completed Martin Odersky's course
Functional Programming Principles In Scala, I am trying to create solution
answers only using concepts introduced in the chapters preceding each exercise. So, for example, the early chapter solutions contain lots of mutable
variables, explicit looping etc


Project build



The project can be built with SBT using the build.sbt file. This should bring down the dependencies for testing using ScalaTest
and supporting running the tests as JUnits if required. Running "test" from sbt should run the 130 or so ScalaTest based tests
which, at the time of writing, should all pass.


The repository doesn't include any Eclipse related files although Eclipse is being used during the development. The SBT eclipse plugin
can be added using

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")

and then the project files created using
sbt eclipse.


Scala version



With Scala 2.10 released on 4th January 2013, I changed the build over to Scala 2.10. This required a few source level changes e.g.



  • explicit imports now required for some of the less commonly used areas of Scala such as scala.language.reflectiveCalls

  • the 2.9.x Actor classes are deprecated in favour of the Akka framework with previous scala.actors code now moved out to a separate jar.
    This required changes to the build script.


The upshot of all this is that the project can no longer be built "as is" with Scala 2.9.x - it requires Scala 2.10

Git and GitHub


As a long term Subversion user, I am using this project to learn Git and GitHub. Apologies for any faux pas!

Acknowledgements


There are plenty of GitHub repositories that contain exercises for one or two chapters of Scala For The Impatient.
Alexander Mikhailov's repository proved a more useful source of inspiration/ideas when stuck!