The Artima Developer Community
Sponsored Link

Artima Developer Spotlight Forum
Alex McGuire on Using Scala in a Large-Scale Project

4 replies on 1 page. Most recent reply: Jul 19, 2009 1:48 PM by Bill Venners

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 4 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Alex McGuire on Using Scala in a Large-Scale Project Posted: Jun 29, 2009 9:30 PM
Reply to this message Reply
Advertisement

Among the benefits of Scala is that it allows one to write code for the JVM, to interface with existing Java libraries, and to do so with fewer lines of code that Java would require. In a recent interview, Alex McGuire, a developer with Électricité de France, describes how his team has been gradually migrating to Scala in a 300,000-line mission-critical production application:

Ten years ago when we started writing the application we knew Java was a much better bet than C++. After all managing memory just shouldn't be the job of someone trying to get their head around pricing exotic options. So we jumped into Java and have been very successful because of it. However, the verbosity of Java has become a growing annoyance.

People complain about excessive use of parentheses in Lisp but Java requires so many just to keep the compiler happy. Then there is all that boiler plate you have to write. Most of the group are into languages so we had been looking at all sorts of alternatives, Lisp, Smalltalk, Pizza, Groovy and Ocaml. We were looking for something to improve our programming experience.

We tried them for small projects and Lisp was quite a good fit to our problem, however the lack of transparent interoperability with our existing codebase was an inhibiting factor. Then we came across Scala. It was just fantastic!

In the interview, McGuire describes how a group of developers with diverse backgrounds was able to move to Scala:

We are all from different backgrounds and consequently have wildly different programming experience. A couple of us had had mathematical training and Scala was just night and day when compared to Java. The rest of the team were all excellent programmers so they made the transition from Java to Scala quickly too.

As with many nascent Scala project, McGuire's team started out writing small parts of the application in Scala, and gradually extending that scope:

As we got confident we just wrote all new components in Scala. Of course there is still work to be done maintaining existing Java modules, so the transition is still ongoing, however the large majority of all new work is in Scala. I personally haven't created a new Java class in over six months. We currently have about 20k lines of Scala and a gradually shrinking base of legacy Java. 20K lines may not sound like a significant percentage of a 300K line system, but the equivalent Java code would be more like 50-60K lines. One of the really nice things about Scala is that you can mix and match it with your old Java code. You can manage risk very well...

Good programmers tend to think in terms of abstractions, and should be able to program these in any number of languages. The choice should never be 'which language do you speak', but rather 'which is best for the job'. So when we recruited we simply looked for good programmers with experience in several languages and they make the transition into Scala easily enough. We had the classical philosophical debates about what Scala can do versus other languages. The key question in the end is "What does it make easy?" You can do anything in most languages but many common things are just not easy or pretty in many of them.

Another common thread in many Scala projects is that developers tend to start out writing Java-like code in Scala, and later learning more idiomatic Scala patterns:

You can begin by writing Scala in a very Java like style. You can leverage your Java knowledge to get into Scala. Take snippets of code in Java and move them into Scala. Just do what comes naturally using the Scala syntax then once you are comfortable and productive start introducing Scala syntax and functional programming techniques, like filtering and maps using anonymous functions etc. Things like the "for" are just so likeable that it does not take a good programmer long to grasp the fact that scala is neat and they just go looking for the features they need. The whole process can go very quickly indeed.

What is your experience incorporating new Scala code into an existing Java codebase? What do you find to be the most problematic issue starting to code enterprise applications in Scala?


Krisztian Sinka

Posts: 30
Nickname: skrisz
Registered: Mar, 2009

Re: Alex McGuire on Using Scala in a Large-Scale Project Posted: Jul 2, 2009 5:29 AM
Reply to this message Reply
It is interesting to see someone get excited about how it can make certain things easier to introduce operator overloading into a Java related language.

Rebol Tutorial

Posts: 2
Nickname: rebol
Registered: Jul, 2009

Re: Alex McGuire on Using Scala in a Large-Scale Project Posted: Jul 5, 2009 5:40 AM
Reply to this message Reply
I have a huge interest in both financial trading and DSL. The easiest language to create DSL is Rebol:

http://reboltutorial.com/blog/create-dsl/

I will create a tutorial for writing a DSL applied to Options Trading in the future.

Scala seems interesting as it can run over Java. I hope one day Rebol will choose to run above .NET and Java !

Balazs Bence Sari

Posts: 1
Nickname: 65204
Registered: Feb, 2009

Re: Alex McGuire on Using Scala in a Large-Scale Project Posted: Jul 11, 2009 5:13 AM
Reply to this message Reply
What IDE do they use for developing in Scala?

Back in 10 yeras ago when I was learning Java I got into it very quickly thanks to the awsomeness of JBuilder 3/4.

Now I am learning Scala and I am looking for an IDE that will make learning the API and the idiomatic language constructs easy-peasy just like JBuilder did 10 years back with Java.

Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: Alex McGuire on Using Scala in a Large-Scale Project Posted: Jul 19, 2009 1:48 PM
Reply to this message Reply
> What IDE do they use for developing in Scala?
>
> Back in 10 yeras ago when I was learning Java I got into
> it very quickly thanks to the awsomeness of JBuilder 3/4.
>
>
> Now I am learning Scala and I am looking for an IDE that
> will make learning the API and the idiomatic language
> constructs easy-peasy just like JBuilder did 10 years back
> with Java.
>
I'm not sure what *they* use, but I use IntelliJ IDEA with its Scala plugin. It works very well these days. The NetBeans plug-in is also pretty usable now. Only the Eclipse plug-in may still not be quite ready for prime time, but it has come a long way lately, so you may want to just try it and see for yourself. I haven't tried Eclipse in a while now, because I have been so satisfied with IDEA's plugin.

Flat View: This topic has 4 replies on 1 page
Topic: Adobe's Rob Christensen on AIR Previous Topic   Next Topic Topic: ZeroTurnaround Offers Free JavaRebel to Scala Users

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use