Mario Fusco
The presentation is an introduction to the Scala language. It will show the most important characteristics and winning points of the language with special attention to some specific features like: the ability to painlessly mix functional and object oriented programming, its powerful collections framework, its type inference mechanism, the clear distinction between mutable and immutable data and how its actor model could make the concurrent programming more effective and less error-prone.
2. Agilité iPhone Java Incubateur
8:15 Accueil des participantsAccueil des participantsAccueil des participantsAccueil des participants
8:40 Mot des organisateurs & Criée des orateursMot des organisateurs & Criée des orateursMot des organisateurs & Criée des orateursMot des organisateurs & Criée des orateurs
9:00 Keynote de Nicolas Martignole (30 minutes)Keynote de Nicolas Martignole (30 minutes)Keynote de Nicolas Martignole (30 minutes)Keynote de Nicolas Martignole (30 minutes)
9:40
10:40
- A1 -
Le terrain Agile
Jean-Philippe Vigniel
- I1-
Hello iPhone
Stephane Tavera
- J1 -
NOSQL also means RDF stores: an
Android case study
Fabrizio Giudci
- X1 -
Le développement durable
Dominic Williams
11:00
12:00
- A2 -
Integration of User Centered Design
in Agile Development of RIA
J. Borkenhagen, J. Desmazières
- I2 -
Développement d'une application
iPhone pilotée par les tests
Emmanuel Etasse, Van-Charles Tran
- J2 -
La Tequila du développement Web
Nicolas Martignole
- X2 -
Cloud Computing: anatomie et
pratique
Marc-Elian Bégin
12:20
13:20
- A3 -
Adoption de l'Agilité par les usages
Xavier Warzee
- I3 -
Distribution d'applications iPhone
en Entreprise: Réalisation d'un
AppStore interne
Géraud de Laval
- J3 -
Vaadin - Rich Web Applications in
Server-side Java without Plug-ins or
JavaScript
Joonas Lehtinen
- X3 -
Les DVCS sont vos amis
Sébastien Douche
Pause repas (50 minutes)Pause repas (50 minutes)Pause repas (50 minutes)Pause repas (50 minutes)
14h10 Keynote de Regis Medina (30 minutes)Keynote de Regis Medina (30 minutes)Keynote de Regis Medina (30 minutes)Keynote de Regis Medina (30 minutes)
14h50
15h50
- A4 -
Scrum, introduction et mise en
oeuvre avec iceScrum
Claude Aubry
- I4 -
Agile iOS Development
Jérôme Layat, Alexander Osterwalder
- J4 -
JAX-RS and Java EE 6
Paul Sandoz
- X4 -
IT Design & Ergonomy
Pascal Petit, Aude Lussigny
16h10
17h10
- A5 -
Agilité : 10 ans déjà
Thierry Cros
- I5 -
Optimizing iOS applications
Marc-Antoine Scheurer
- J5 -
Ecrivez et automatisez vos tests
fonctionnels avec jBehave
Xavier Bourguignon
- X5 -
NoSQL : Enfin de la biodiversité
dans l'écosystème des BD
Olivier Mallassi
17h30
18h30
- A6 -
Lean engineering
Jean-Christophe Dubail
- I6 -
iPhone et Agile, l'amour vache
Guillaume Duquesnay
- J6 -
Let's make this test suite run faster
David Gageot
- X6 -
The feel of Scala
Mario Fusco
Mot de la fin & tombolaMot de la fin & tombolaMot de la fin & tombolaMot de la fin & tombola
Programme de la Conférence
www.soft-shake.ch
3. The Feel of
Mario Fusco
mario.fusco@gmail.com
Twitter: @mariofusco
by
7. Functions and Closures
val isPositive = (x: Int) => x > 0
val numbers = List(-10, 5, 3, -2, 0, 1)
val positiveNumber = numbers.filter(isPostive)
val positiveNumber = numbers.filter(x => x > 0)
val positiveNumber = numbers.filter(_ > 0)
9. Tuples
val pair = (2, “items”)
println(pair._1) // prints 2
println(pair._2) // prints items
10. Clear distinction between
mutable and immutable data
val msg = “Hello,world!” // constant
var value = 3 // variable
scala.collection
scala.collection.immutable scala.collection.mutable
11. Named and default parameters
class Person(name: String = "Goofy", age: Int = 30,
location: String = "Milano")
Person(name = "Mario", age = 36, location = "Lugano")
Person(age = 36, location = "Lugano", name = "Mario")
Person(age = 36, name = "Mario")
Person(age = 36)
Person()
12. Operator overloading
class Rational (n: Int, d: Int) {
def this(n: Int) = this(n, 1)
def + (that: Rational): Rational =
new Rational(n * that.d + that.n * d, d * that.d)
def + (i: Int): Rational = new Rational(n + i * d, d)
}
13. Implicit conversion
val a = new Rational(2, 3)
val b = a + 2 // = 8/3
val c = 2 + a // Compilation Error
implicit def intToRational(x: Int) = new Rational(x)
Val c = 2 + a // = 8/3
14. Options
Tony Hoare, who invented the null reference in 1965 while
working on an object oriented language called ALGOL W, called
its invention his “billion dollar mistake”
val capitals = Map("Italy" -> "Rome", "Switzerland" -> "Bern",
"Germany" -> "Berlin" , "France" -> "Paris")
println(capitals.get("Italy")) // Some(Rome)
println(capitals.get("Spain")) // None
println(capitals.get("Italy").get) // Rome
println(capitals.get("Spain").get) // thorws Exception
println(capitals.get("Spain").getOrElse("Unknown")) // Unknown
15. Traits
class Animal { def eat(): Unit }
trait Mammal extends Animal { def giveBirth(): Mammal }
trait HasWings extends Animal { def fly(): Unit }
trait HasLegs extends Animal { def walk(): Unit }
class Snake extends Animal
class Frog extends Animal with HasLegs
class Cat extends Animal with Mammal with HasLegs
class Bat extends Animal with Mammal with HasWings
class Chimera extends Animal with Mammal with HasWings with HasLegs
16. Case classes
trait Expr
case class Var(name: String) extends Expr
case class Number(num: Double) extends Expr
case class Unop(op: String, arg: Expr) extends Expr
case class Binop(op: String, l: Expr, r: Expr) extends Expr
17. Pattern matching
def simplify(expr: Expr): Expr = expr match {
case Unop("-", Unop("-", e)) => e // Double negation
case Binop("+", e, Number(0)) => e // Adding zero
case Binop("*", e, Number(1)) => e // Multiplying by one
case _ => expr
}
// Simplify double negation: simplified = Var("x")
val simplified = simplify(Unop("-", Unop("-", Var("x"))))
18. Structural Typing
(duck typing done right)
class Duck {
quack() { println "quack" }
}
doQuack(new Duck)
doQuack(d) { d.quack() }
class Dog {
barf() { println "barf" }
}
doQuack(new Dog)
def doQuack(d:{ def quack():Unit }) =
d.quack()
class Duck {
def quack() = println "quack"
}
doQuack(new Duck)
class Dog {
def barf() = println "barf"
}
doQuack(new Dog)runtime error
compilation
error
Duck typing is the dynamic mechanism that allows to discover a dog cannot
say quack only at runtime... in production ... on friday evening
19. Actors
val printerActor = actor {
loop {
receive {
case s: String => println("I got a String: " + s)
case i: Int => println("I got an Int: " + i.toString)
case _ => println(" I don’t know what I got ")
}
}
}
printerActor ! "hi there“ // prints “I got a String: hi there”
printerActor ! 23 // prints “I got an Int: 23”
printerActor ! 3.33 // prints “I don’t know what I got”
22. Norbert by LinkedIn
• Norbert is a framework written in Scala that
allows to write asynchronous, message based,
client/server applications
• Built on Apache ZooKeeper and JBoss Netty,
Norbert to make it easy to build a cluster aware
application
• Provides out of the box support for notifications
of cluster topology changes, application specific
routing, load balancing and partitioned workload
23. • Akka is a framework that allows to write simpler
concurrent (yet correct) applications
• It provides a higher level of abstraction for
writing concurrent and distributed systems
through (remote) actors
• It implements Software Transactional Memory
(STM) turning the Java heap into a transactional
data set with begin/commit/rollback semantic
• Fault-tolerant adopting the "Let it crash" /
"Embrace failure" model
24. SBT (simple-build-tool)
• Sbt is a build tool written in Scala
• Uses the same directory structure as
Maven for source files
• Uses Ivy to resolve dependencies
• Compatible with Maven configuration files
• Supports testing with ScalaTest
• Parallel task execution, including parallel
test execution