Présentation (brève) de scala
Transcript of Présentation (brève) de scala
![Page 1: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/1.jpg)
Présentation (Brève) de Scala
Présentation (Brève) de Scala
Clément Simon
6 avril 2015
![Page 2: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/2.jpg)
Présentation (Brève) de Scala
Introduction
I Scala fonctionne sur la JVM ;
I "Let the compiler figure out the types for you" ;
I Scala est très condensé.
![Page 3: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/3.jpg)
Présentation (Brève) de Scala
Syntaxe
Variables
Les Variables
I var : variables ;
I val : variables statiques .
Le typage d’un attribut s’effectue tel que : " var v :monType "
![Page 4: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/4.jpg)
Présentation (Brève) de Scala
Syntaxe
Variables
Les Tableaux
var tab = new ArrayBuffer[A]()
for(a:A <- tab ){...}
![Page 5: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/5.jpg)
Présentation (Brève) de Scala
Syntaxe
Fonctions & Méthodes
def maFunction(param1:A) ={...}
![Page 6: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/6.jpg)
Présentation (Brève) de Scala
Syntaxe
Fonctions & Méthodes
def maFunction(param1:A): ReturnType ={...}
I :Unit <=> Void ;I :String <=> String ;I :Int <=> Int ;I ...
![Page 7: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/7.jpg)
Présentation (Brève) de Scala
Syntaxe
Classes
class B extends A {public var a;private var b;
}
I abstract ;
![Page 8: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/8.jpg)
Présentation (Brève) de Scala
Syntaxe
Constructeur(s)
class A(var a:Int) { }class B(a:Int) extends A(a) { }
![Page 9: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/9.jpg)
Présentation (Brève) de Scala
Syntaxe
Constructeur(s)
class Z(a:Int , b:String) {def this(a:Int) ={
this(a,"")}
}
![Page 10: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/10.jpg)
Présentation (Brève) de Scala
Syntaxe
Type
abstract class M {type X >: Scala.null <: Ztype Acompatible <: Avar mesA = new ArrayBuffer[Acompatible ]()
}
class N extends M{override type Acompatible = B
}
class B extends A {override type Mcompatible = N
}
![Page 11: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/11.jpg)
Présentation (Brève) de Scala
Syntaxe
Type
abstract class M {type Acompatible <: Avar mesA = new ArrayBuffer[Acompatible ]()
def maMethode(a:Acompatible ):Unit {a.maMethode2(this.asInstanceOf[a.Mcompatible ])
}}
![Page 12: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/12.jpg)
Présentation (Brève) de Scala
A retenir
Ce qu’il faut retenir :I Langage condensé ;I Typage "post-variable" ;I Objet ;I Les Types.
![Page 13: Présentation (brève) de scala](https://reader031.fdocuments.fr/reader031/viewer/2022013122/55c46604bb61ebaa478b4638/html5/thumbnails/13.jpg)
Présentation (Brève) de Scala
Remerciement
Merci pour votre attention.
Présentation disponible sur slideshare.net