Devoxx 2011: A crash course in Scala
Join the DZone community and get the full member experience.
Join For FreeDevoxx time again, 4th year that I’m attending. This morning I went to see the talk by Mario Fusco and Kevin Wright.
The first part was by Mario and handled the Scala basics. The talk
itself was a bit messy. It was a mix of API features and a comparison
with Java, Groovy and Haskell.
He showed some cool language features, but overall it was just an API
features list, but the demo that was given was pretty cool. The demo
showed how easily you could create a DSL with Scala.
In 2 minutes he was able to write something like this.
twice{ 3 times{ println("hello") }the }
Eventually the code printed “hello” 6 times. It is a bit a trivial example, but really fun to see what the power is of scala.
The second part of the talk was about how Scala would be agile in a
project. Kevin also emphasized on the way we can write code that is very
readable for developers and for the business users. He started with an
example that he apparently stole from Dick Wall . The example just showed how everything in Scala is manipulable.
A long time ago in a galaxy far far away
translated into
A.long(time).ago(in).a(galaxy).faA.long(time).ago(in).a(galaxy).far(far).away()r(far).away()
So these are just a class (A), a few methods (long, ago, a, far and away) and some vals (time, in, galaxy and again far).
This was quite nice and showed the potential to build readable code for the business users.
For a more powerful example he referenced to a gist
he created on github, where a string of validation rules can easily be
added to a processor and then return the result. (on top you have the
method declarations, on line 44 you got the actual processor that is
being defined and at the bottom you find some test with the result in
comment).
https://gist.github.com/1262988
Again, I heard that the best way to start with Scala is to write your
tests in Scala. This code does not go into production so it does not
create a risk, but the developers start playing with and learning Scala
so they get a good feel about what is possible.
The most important thing I remember from this talk is that you can learn
a fair amount of Scala in 2 weeks, but you’ll need more time to learn a
specific business domain. By writing your business apps in readable Scala, you could lower the step to get into the business.
It was an interesting talk that showed possible usages of Scala in a
real environment, but I’m not sure it convinced many people to start
using Scala.
From http://styledideas.be/blog/2011/11/14/devoxx-2011-a-crash-course-in-scala/
Opinions expressed by DZone contributors are their own.
Comments