Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been promoting Scala at work as something we should try out for things like testing with Specs and rapid prototyping of web services with tools like Scalatra and Lift

A technical manager is interested in hearing more about Scala, and has no experience with the language. I've pointed out how Scala prototypes could be written quickly and deployed into our existing Java infrastructure as well as use our existing Java libraries. He is largely interested in the specific benefits of using Scala over Java and will be interested in concrete examples.

I'd like to hear any thoughts or experiences people have introducing Scala to technical management. Thoughts on good code, clear, concise examples that demonstrate a big win over the Java equivalent, would be greatly appreciated.

Some examples areas for discussion I have been thinking about are:

A big win over Java, and I use it every day to test the Java code I am writing.

Basic Collection Iteration
One of the first areas I think Java programmers can see immediate benefit.

Type Inference
We use a lot of Python at work - I think less type boilerplate in a strongly typed language will be appealing.

Java Integration
Given our Java investment, this will be a biggie.

A brief run through of Akka actors and the new parallel collections. I'd love to see any small, focused examples anyone has here.

I've been finding BDD with Specs excellent for testing Java applications.

Web development
I've found Scalatra ideal for rapid development of REST services.

Please share any other areas you think might be of interest as well as any focused code examples in these or other areas you think demonstrate advantages of Scala over the Java equivalent.

EDIT: To be perfectly clear I am primarily interested in concise concrete code examples appropriate to this situation. Not at all interested in another "Java vs Scala" thread. I hope that was clear. Something like:


Foo theFoo = null;
for(Foo aFoo: allTheFoos) {
  if (aFoo.getId().equals(theIdIWant)) {
    theFoo = aFoo;


val theFoo = allTheFoos.find( == theIdIWant)

migration rejected from Nov 9 '15 at 17:35

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as too broad by gnat, durron597, Ixrec, Snowman, Ampt Nov 9 '15 at 17:35

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

i think this is suited more in than in here , here we want code :D – Saif al Harthi Jan 22 '11 at 16:53
I considered it, but I'm really very much hoping to compile a set of good code examples. This is not a PowerPoint pitch. I need to show concrete code examples. – Janx Jan 22 '11 at 16:58
What's a technical manager? If you're pitching to just one person, it matters a lot who they are and how they think. – huynhjl Jan 22 '11 at 19:11
Excellent point about audience - In this case the tech lead on my project and a top level engineer in the company. A person who still writes a lot of code (mostly C++) but also does a lot of architecture and design and has considerable influence on company technical direction. – Janx Jan 22 '11 at 20:06