in Java, Scala

First glance at Scala

Today I took a first glance at Scala at the Paris JUG monthly meeting. Scala is a programming language which runs on the Java Virtual Machine.
I have not compiled a single line of code in Scala yet but I saw enough code to get a decent idea of it.
When you think Scala, think about the functional programming paradigme. A function can be a value.
The first speaker, Sader Drobi, showed us a few examples of code to illustrate the advantages of passing a function as a parameter.

object FirstTest {

def myfunction(callback: () => Unit) {

callback();

}

def otherfunction() {

println("Hello")

}

def main(args: Array[String]) {

myfunction(otherfunction)

}

}

In this example, the function myfunction takes a function (anotherfunction) as a parameter. It prints hello.

And then Romain Maton and Nicolas Jozwiak, from Xebia, gave us a good presentation of the language (history, Martin Odersky, frameworks, functional programming, actors, traits, IDE plugins …). Apparently a trait in Scala can be seen as a Java interface in which one can define methods. I liked their example based on the Visitor pattern.

Everything is an object in Scala.

A few links to begin with :

http://www.scala-lang.org

http://www.artima.com/scalazine

http://www.codecommit.com/blog

http://groups.google.com/group/paris-scala-user-group

http://thecodersbreakfast.net/index.php?post/2010/04/11/Paris-JUG-Scala

I look forward to taking the time to learn more about this language and start coding with it.

Juscala ça va 😉