The Artima Developer Community
Sponsored Link

Artima Developer Spotlight Forum
Jonas Bonér on Real-World Scala

6 replies on 1 page. Most recent reply: Oct 8, 2008 4:14 PM by James Watson

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 6 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Jonas Bonér on Real-World Scala Posted: Oct 4, 2008 1:17 AM
Reply to this message Reply
Advertisement

In the quest to find alternative languages for the JVM that promise greater productivity than Java, but also provide static typing and some of Java's other advantages, Scala increasingly tops the list of possibilities. Although there is increasing discussion about Scala, and even a new book, few developers have actually used the language in real-world applications.

In that sense, Jonas Bonér's Scala experience is unique: For the past nine months, Bonér has been working with a team on a production application, which is his company's main product. Best known for his work on scalable Java systems and on the open-source Terracotta clustering engine, Bonér decided to share his experience in what promises to be a series of blog posts on real-world uses of Scala:

To be honest, the trip has been a bit bumpy sometimes, but now after nine months of development I can say that Scala pulled it off. [The] risks were manageable. We are very happy with the strategic decision to use Scala.

Bonér points to two main risk factors when choosing Scala for his application:

  • Technology: will the technology deliver, can we fix or work around the problems that will emerge down the road etc.?
  • Education: will the process and time needed to be invested in learning a new language and paradigm slow us down too much?

According to Bonér, both risks were manageable:

Technology-wise, one of the biggest problems of using Scala in a JEE application stack is that there are (currently) no frameworks, patterns or “best-practices” that will help you address fundamental issues like:

  • Dependency Injection (DI)
  • Code tangling and scattering e.g. AOP
  • Transaction demarcation and context propagation
  • Component life-cycle

Basically, we didn’t have a “container” that could handle this for us so we had to write it ourselves. The good thing is that most Java frameworks works very nicely with Scala. For example, we have had no problems using JPA, Wicket etc. and deploy it in a standard JEE appserver.

Similarly, Bonér points out that coming up to speed on Scala wasn't a difficult task:

Education ... turned out to not be much of an issue. Our developers who had never written a line in Scala and had very little experience with FP in general were fully up to speed in a couple of months. The first weeks there were some complaints but now they are loving it. Scala gives a smooth learning curve to FP since it, being a unique blend of the OO and FP paradigms, allows one to start with a very Java-esque imperative style of programming and gradually move towards a functional style. Now we have rewritten most of the imperative chunks of code that were written during the early education stages.

What is your experience in using Scala in a real-world project? Do you feel that the language and its supporting tools are mature enough to allow you to dive into a production Scala project?


alpha alpha

Posts: 8
Nickname: alpha512
Registered: Mar, 2007

Re: Jonas Bonér on Real-World Scala Posted: Oct 4, 2008 8:45 AM
Reply to this message Reply
It is easy to manage Wicket with Scala? What about the inner classes?, anyone have a sample I could take a look?.

Sounds very interested Scala maybe I will jump in. I just need to buy the book of Martin Odersky. I really want to use Scala with Wicket and Guice.

This is Nice article.

alpha alpha

Posts: 8
Nickname: alpha512
Registered: Mar, 2007

Re: Jonas Bonér on Real-World Scala Posted: Oct 4, 2008 8:48 AM
Reply to this message Reply
By the way it could be fun to port wicket to Scala, For the UI declaration could be something amazing as builders and events using closures.

Compile and just drop the war to tomcat container.

Tom Flaherty

Posts: 7
Nickname: axiom6
Registered: Dec, 2006

Re: Jonas Bonér on Real-World Scala Posted: Oct 7, 2008 10:16 AM
Reply to this message Reply
This is a great post

Jonas's work demonstrates how Scala’s “novel ways to abstract and compose programs” addresses DI and AOP.

I am also glad that Jonas mentioned the Cake pattern in the paper “Scalable Component Abstractions” because this paper is a gold mine for tackling difficult problems.

We are just beginning to understand Scala’s “novel ways”

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Jonas Bonér on Real-World Scala Posted: Oct 7, 2008 1:24 PM
Reply to this message Reply
> Jonas's work demonstrates how Scala’s “novel ways to
> abstract and compose programs” addresses DI and AOP.

This is something that confused me. It seems to me that DI and AOP are tools to address the deficiencies in languages like Java. But in this blog entry, it's implied that they had to write their own container to incorporate these features.

Jonas Bonér

Posts: 5
Nickname: jboner
Registered: Dec, 2007

Re: Jonas Bonér on Real-World Scala Posted: Oct 7, 2008 2:18 PM
Reply to this message Reply
> > Jonas's work demonstrates how Scala’s “novel ways to
> > abstract and compose programs” addresses DI and AOP.
>
> This is something that confused me. It seems to me that
> DI and AOP are tools to address the deficiencies in
> languages like Java. But in this blog entry, it's implied
> that they had to write their own container to incorporate
> these features.

When I wrote that we had to "write our own container", I was just trying to explain that we had to find ways of implementing the functionality of a "container". However, most of the stuff could be elegantly solved using language constructs and abstractions. For example, this is how we solved DI (using the Cake Pattern):

http://jonasboner.com/2008/10/06/real-world-scala-dependency-injection-di/

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Jonas Bonér on Real-World Scala Posted: Oct 8, 2008 4:14 PM
Reply to this message Reply
> When I wrote that we had to "write our own container", I
> was just trying to explain that we had to find ways of
> implementing the functionality of a "container". However,
> most of the stuff could be elegantly solved using language
> constructs and abstractions. For example, this is how we
> solved DI (using the Cake Pattern):

Thanks for clarifying. While I have apprehensions about using Scala for team development, the understanding that it removes the need for a lot of cruft still keeps me interested. I'll read the rest of this series and see if you address/solve the issues I worry about.

Flat View: This topic has 6 replies on 1 page
Topic: Doron Reuveni on uTest's Marketplace of Bugs Previous Topic   Next Topic Topic: The Adventures of a Pythonista in Schemeland, Part 5


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us