This document discusses the Scala programming language. It begins by asking why Scala should be used instead of Java on the JVM. It then provides quotes from experts like James Gosling and Charles Nutter saying Scala is the heir to Java and they would have used Scala instead of creating other languages if they knew about it earlier. The document then discusses key aspects of Scala like being object-functional, statically typed, expression-oriented, concise, pragmatic and interoperable with Java. It concludes by advertising live demos that will showcase features like classes, testing with ScalaTest, implicit conversions, functional programming with lists, traits, type parameters and pattern matching.
4. WARUM SCALA?
Scala, it must be stated, is the current
heir apparent to the Java throne.
Charles Nutter
5. WARUM SCALA?
I can honestly say if someone had shown me ... Scala ...
back in 2003 I'd probably have never created Groovy.
James Strachan
6. obje
eift kt-fu pis iert
a us ger nkti
ona tisc h ty
l sta
leich ark
tgew sst
icht
ig WAS IST SCALA? au sdr uck
knap inte
rope
p un
d pr ati sch rabe
äzis
e p ragm l mit
Java
13. AUSDRUCKSSTARK
"Calling Person.toString" when {
"first and last name are not-empty" should {
"return first name blank last name" in {
val person = new Person("John", "Doe")
person.toString should be ("John Doe")
}
}
}
14. KNAPP UND PRÄZISE
public class Person { // Java
private final String firstName;
private final String lastName;
public class Person(val firstName: String,
Person(String firstName, String lastName) {
val lastName: String)
this.firstName = firstName;
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
}
18. Klas
sen-
as sen Para thoden
Kl m eter M e
LIVE DEMO: OO-GRUNDLAGEN
Defa Com
ult-Ar pan
gum Fe lder ion
Obje
ente cts
19. rkz eug
st- We
Te
LIVE DEMO: SCALATEST
DSL
-Bei
spie
l
20. Für
Libr
ary-E
ntw
icklu
ng
LIVE DEMO: IMPLICIT CONVERSIONS
pra che
rbare S
Skalie
21. Unv
Type erän
Infe ato ren Obje
derl
iche
renc
e O per kte
LIVE DEMO: FUNKTIONALE LISTE
nen g Funk
ktio nun
Fun Ord
tion
slite tio nen
rer rale Funk
h öhe
22. Meh
rfac
hver
erbu
ng r
icht
ig ge
mac
ht
LIVE DEMO: TRAITS
ns
c atio
M odifi
ackabe
St
23. Upp ma cht Low
er B i g ge er Bo
ound i cht und
s eri cs r s
Gen
LIVE DEMO: TYP-PARAMETER
i anz
Kov
aria ari anz
In var nz trav
Kon
24. Swit
tern ch rich tern
Pat tig g Pat
d card ema nst ant
Wil c ht Co
LIVE DEMO: PATTERN MATCHING
Vari ern Seq
able att u ence
Patt t or P Patt
e rn st ruc ern
Con
25. pra che
er S
in d
L ite rale
LIVE DEMO: XML-SUPPORT
XPa
th-A
bfra
gen