Scala: Our Retrospective of the benefits/drawbacks
Date: 2011-11-28 00:15:00

As the closing part of a http://www.markhneedham.com/blog/2011/11/24/xp-day-scala-an-experience-report-liz-douglass-and-me/[Scala Experience Report] http://twitter.com/#!/lizdouglass[Liz] and I gave at XP Day we detailed a retrospective that we'd carried out on the project after 3 months where the team outlined the positives/negatives of working with Scala.

The team members who were there right at the beginning of the project 3 months earlier had come up with what they thought the proposed benefits/drawbacks would be so it was quite interesting to look at our thoughts at both times.

Some of this is available in our slides from the talk but http://twitter.com/natpryce[Nat Pryce] suggested it'd be interesting to post it up in more detail.

We weren't aware that we'd be doing this exercise until the session where we did it and noone looked at the original answers so hopefully some of the potential biases have been removed!

== JUNE

* +++ Increased developer productivity
 ** Higher-level language constructs (functional programming, actors, pattern matching, mixins, etc.)
 ** Less code \-> less time spent reading code / less defects
 ** Syntax is better suited for writing DSLs (e.g. SBT, Scalatra, ScalaTest, etc.)
* +++ Bigger potential to attract talented developers (not using the same old 'boring' stack)
* ++ Gentle learning curve for Java devs
* + Built-in support at language-level for handling XML
* + Comes with SBT, a powerful build tool
* + Seamlessly integrates with Java and it's ecosystem
* + Runs on the JVM (i.e. no operational concerns)

* --- Bigger potential to screw things up (think: "with great power comes\...")
* -- Tool support is less mature and polished (e.g. IDEs, profilers, metrics, etc.)
* - Community is younger and smaller
* - Scala compiler seems to be slower than Java counterparts

== SEPTEMBER

Liked:

* +8 Easy to learn
* +8 Functional Language (Immutable, closures, etc)
* +6 Concise code
* +5 SBT power
* +4 Case classes
* +4 XML support
* +4 Java integration
* +3 List processing
* +3 DSL support
* +2 Helpful community (IRC, StackOverflow)
* +2 Performance

Disliked:

* -8 IDE support (refactoring, plugin quality)
* -5 Slow compiler
* -3 Code can become complex to read
* -2 Lack of XPath support in XML
* -2 SBT complexity
* -2 Immature frameworks

Quite a few of the expected benefits from June were observed in June, such as having to write less code, functional programming constructs, XML support and the ability to write DSLs.

The community was one benefit which wasn't expected - we've found that every time we get stuck on something we can go on Stack Overflow and find the answer and if that doesn't work then someone on IRC will be able to help us almost immediately.

== Complexity

Our experience with Scala's complexity http://blog.joda.org/2011/11/scala-feels-like-ejb-2-and-other.html[partly matches with that of Stephen Coulbourne] who suggests the following:

____
Scala appears to have attracted developers who are very comfortable with type theory, hard-core functional programming and the mathematical end of programming. \... There is also a sense that many in the Scala community struggle to understand how other developers cannot grasp Scala/Type/FP concepts which seem simple to them. This sometimes leads Scala aficionados to castigate those that don't understand as lazy or poor quality developers.
____

We've tried to be reasonably sensible with the language and only used bits of it that the whole team are likely to understand rather than learning some obscure way of solving a problem and checking that in.

On the other hand reading the code of Scala libraries such as https://github.com/scalaz/scalaz[scalaz] or https://github.com/harrah/xsbt[SBT] is something that I, at least, find extremely difficult.

Changing the SBT build files can be quite a scary experience while you try and remember what all the different symbols mean and how they integrate together.

== Learning curve

The learning curve for Java developers has been a bit of a mixed experience.

When we started working on the project we were effectively writing Java in Scala and we've slowly learnt/introduced more Scala features into our code as time has passed.

I think everyone who has come on that journey has found the transition reasonably okay but we've had other team members who joined later on and went straight into code that they weren't familiar with and for them it's been more difficult.

== Again, again!

It will be interesting to see the team's thoughts if we do the exercise again 3 more months on.

I would imagine there would be more 'dislikes' around code complexity now that the code has grown even more in size.

It probably also mean the lack of IDE support becomes more annoying as people want to refactor code and can't get the seamless experience that you get when editing Java code.