So perhaps one of the most prolific uses of Scala is in the back end of Twitter. Originally Twitter was written using Ruby on Rails, and, in fact, most of the user-facing content still is. However, some of the backend functionality of the site was written in Scala and now runs on the Java Virtual Machine.

One of the reasons Twitter moved is that Rails had performance limitations, especially at runtime. Also, the team behind Twitter felt Ruby lacked some of the things that contribute to reliable, high performance code, but they enjoyed the flexibility of Ruby as a language so they turned to Scala. Some problems Ruby had specifically where long-lived processes. Apparently, the JVM is better apt at handling these. Additionally, it was mentioned that thread support for Ruby was lacking. Lastly, the team felt they were spending time writing their own type system, and doing so badly. Alex Payne said, “I think it may just be a property of large systems in dynamic languages, that eventually you end up rewriting your own type system, and you sort of do it badly. You’re checking for null values all over the place. There’s lots of calls to Ruby’s kind_of? method, which asks, “Is this a kind of User object? Because that’s what we’re expecting. If we don’t get that, this is going to explode.” It is a shame to have to write all that when there is a solution that has existed in the world of programming languages for decades now”.

More information on how the Twitter Team feels about Scala, why they made the switch, and resources they used for starting can be found below here and here.