Mark Needham

Thoughts on Software Development

Scala: Our Retrospective of the benefits/drawbacks

with 7 comments

As the closing part of a Scala Experience Report 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 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 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 scalaz or 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.

Be Sociable, Share!

Written by Mark Needham

November 28th, 2011 at 12:15 am

Posted in Scala

Tagged with

  • https://me.yahoo.com/a/vRFkmw5tg_SZFqKXfqSpZnEL3Q--#dd008 sudr

    Thanks for posting. I’d known that IDE support was pretty lacking and doesn’t seem to have improved. Hopefully the plugin projects are looking at this and identifying where the disconnect is.

  • martin odersky

    Thanks for the comments. This is very helpful for us because it tells us where we should focus our efforts. The final version of Scala Eclipse IDE 2.0 will be out soon. It is in RC2 now, which will be turned to final this week if nothing serious is reported. Refactoring is still rudimentary but is top on our list of priorities for the next version.

    Regarding scalaz or SBT, it’s important to note that these are in my opinion not very idiomatic Scala code. Take them as examples what one can do in the extreme. Scalaz is an impressive piece of software. But I personally would never program that way, and most people I know wouldn’t either.

  • Kipton Barros

    Regarding IDE support, the Eclipse Scala IDE has drastically improved over the last year. Yes, it’s still missing advanced refactoring features, but in my experience at least, the core is now pretty solid.

  • steve johnston

    +1 for the Scala Eclipse IDE!

    Regarding SBT, is it the use of tool that, in your opinion, isn’t idiomatic or is it the code used to implement SBT?  

  • Jim OFlaherty

    Wow! Tyvm for posting about your experience.

  • http://www.markhneedham.com/blog Mark Needham

    We’ve actually been using IntelliJ so the comments above about IDE support refer to that rather than eclipse. May be interesting to check out eclipse then and see if the support is better…

  • Scala Beginner

    Scala beginner here.  Thanks for posting your experience, I have been looking forward to such report.

    But I must disagree with you at this point:”Code can become complex to read”You can make hard-to-read code in any language, as you can make easy-to-read code in (almost) any language too, including Scala.  IMO it’s not (in most cases) a language issue, it all depends on the developer, don’t you think?
    My 2 cents.