Basic Wicket and Scala

  • 10,008 views
Uploaded on

This presentation is about doing Scala with Wicket. The basics of Scala are handled with a simple Hello World application. After that I explain some functional concepts and show a basic Wicket …

This presentation is about doing Scala with Wicket. The basics of Scala are handled with a simple Hello World application. After that I explain some functional concepts and show a basic Wicket application written in Scala.

Daan van Etten gave this presentation at the ApacheCon Wicket meetup in Amsterdam, March 24, 2009. You can find the mentioned source code at http://stuq.nl/weblog/2009-03-24/amsterdam-wicket-meetup-2009

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • can i have a soft copy of this presentation ?
    Are you sure you want to
    Your message goes here
  • Basic Wicket and Scala
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
10,008
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
2
Comments
2
Likes
37

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide




























  • http://www.artima.com/weblogs/viewpost.jsp?thread=163733
  • Lausanne


  • Pizza is an open-source superset of the Java programming language with the following new features:
    Generics
    Function pointers
    Class cases and pattern matching (a.k.a Algebraic types)




  • Started designing Scala in 2001
  • In 2001, the design for Scala started
  • Scala, whose design began in 2001, and which was first released in 2003. Scala is not an extension of Java, but it is completely interoperable with it. Scala translates to Java bytecodes, and the efficiency of its compiled programs usually equals Java's. A second implementation of Scala compiles to .NET. (this version is currently out of date, however).
    Scala was designed to be both object-oriented and functional. It is a pure object-oriented language in the sense that every value is an object. Objects are defined by classes, which can be composed using mixin composition. Scala is also a functional language in the sense that every function is a value. Functions can be nested, and they can operate on data using pattern matching.
  • 2003, first release of Scala
  • From the start, Scala is functional and object oriented, like Java
  • From the start, Scala is purely functional.
    functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data.

  • Like Java, unlike Groovy
  • This also works with functions
    def sayHello = System.out.println(\"hello world\")

  • This also works with functions
    def sayHello = System.out.println(\"hello world\")

  • This also works with functions
    def sayHello = System.out.println(\"hello world\")

  • This also works with functions
    def sayHello = System.out.println(\"hello world\")



  • The + is a method defined in class Int
  • The + is a method defined in class Int


  • The name Scala stands for “scalable language.” The language is so named because it was designed to grow with the demands of its users. You can apply Scala to a wide range of programming tasks, from writing small scripts to building large systems.






  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Functional programming languages generally avoid state and try to have immutability






  • The + is a method defined in class Int
  • The + is a method defined in class Int
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Higher order functions accept functions as parameters and return functions too.
  • Higher order functions accept functions as parameters and return functions too.
  • Higher order functions accept functions as parameters and return functions too.
  • Higher order functions accept functions as parameters and return functions too.
  • Higher order functions accept functions as parameters and return functions too.
  • Higher order functions accept functions as parameters and return functions too.
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
  • Erlang,[2] OCaml,[3] Haskell,[4] Scheme[5][6] and domain-specific programming languages like R (statistics),[7] Mathematica (symbolic math),[8] J and K (financial analysis), and XSLT (XML).
















































































































Transcript

  • 1. Basic Wicket and Scala Daan van Etten http://stuq.nl Amsterdam, March 24, 2009 Wednesday, March 25, 2009
  • 2. Hi! Wednesday, March 25, 2009
  • 3. Goal: After this talk, you can start coding Wicket in Scala. Wednesday, March 25, 2009
  • 4. Overview Wednesday, March 25, 2009
  • 5. Scala Wednesday, March 25, 2009
  • 6. What is Scala ? Wednesday, March 25, 2009
  • 7. Hello, World! Wednesday, March 25, 2009
  • 8. Functional concepts Wednesday, March 25, 2009
  • 9. + Wednesday, March 25, 2009
  • 10. ? Wednesday, March 25, 2009
  • 11. Simple project Wednesday, March 25, 2009
  • 12. maven Wednesday, March 25, 2009
  • 13. Java Scala Wednesday, March 25, 2009
  • 14. Wednesday, March 25, 2009
  • 15. Who am I? Wednesday, March 25, 2009
  • 16. Wednesday, March 25, 2009
  • 17. Daan van Etten Wednesday, March 25, 2009
  • 18. Daan van Etten gineer are En tw Sof Wednesday, March 25, 2009
  • 19. Daan van Etten eer ngin ftware E So Wednesday, March 25, 2009
  • 20. Daan van Etten er e Engine Softwar @work Wednesday, March 25, 2009
  • 21. Daan van Etten er e Engine Softwar Wednesday, March 25, 2009
  • 22. Daan van Etten er e Engine Softwar Wednesday, March 25, 2009
  • 23. Let’s begin Wednesday, March 25, 2009
  • 24. What is Scala ? Wednesday, March 25, 2009
  • 25. Scala Wednesday, March 25, 2009
  • 26. Scala History Wednesday, March 25, 2009
  • 27. Scala 1958 Wednesday, March 25, 2009
  • 28. Scala Martin Odersky Wednesday, March 25, 2009
  • 29. Scala Wednesday, March 25, 2009
  • 30. Scala Compilers Wednesday, March 25, 2009
  • 31. Scala Functional languages Wednesday, March 25, 2009
  • 32. Scala Functional languages (more about that later) Wednesday, March 25, 2009
  • 33. Scala Wednesday, March 25, 2009
  • 34. Scala Generic Java Wednesday, March 25, 2009
  • 35. Scala Wednesday, March 25, 2009
  • 36. Scala Java 5 Generics Wednesday, March 25, 2009
  • 37. Scala New javac Wednesday, March 25, 2009
  • 38. Scala 2001 Wednesday, March 25, 2009
  • 39. Scala Scala Wednesday, March 25, 2009
  • 40. Scala First release Wednesday, March 25, 2009
  • 41. Scala 2003 Wednesday, March 25, 2009
  • 42. Scala Object Oriented Wednesday, March 25, 2009
  • 43. Scala Functional Wednesday, March 25, 2009
  • 44. Scala Statically typed Wednesday, March 25, 2009
  • 45. Scala Type inference Wednesday, March 25, 2009
  • 46. Scala Type inference var foo = 8 Wednesday, March 25, 2009
  • 47. Scala Type inference var foo = 8 foo = “bar” Wednesday, March 25, 2009
  • 48. Scala Type inference type mismatch; var foo = 8 found: String(quot;barquot;) foo = “bar” required: Int Wednesday, March 25, 2009
  • 49. Scala Every value is an object Wednesday, March 25, 2009
  • 50. Scala Every value is an object var foo = 8 Wednesday, March 25, 2009
  • 51. Scala Every value is an object var foo = 8 def bar(a: String)= println(a) Wednesday, March 25, 2009
  • 52. Scala Every operation is a method call Wednesday, March 25, 2009
  • 53. Scala Every operation is a method call 1+3-6 Wednesday, March 25, 2009
  • 54. Scala Every operation is a method call 1+3-6 1.+(3).-(6) Wednesday, March 25, 2009
  • 55. Scala Compiles to Java bytecode Wednesday, March 25, 2009
  • 56. Scala Runs on the Java VM Wednesday, March 25, 2009
  • 57. Scala Scalable From small scripts to large systems Wednesday, March 25, 2009
  • 58. Scala Hello, World! Wednesday, March 25, 2009
  • 59. Scala object HelloWorld { def main(args: Array[String]) { println(quot;Hello, world!quot;) } } Wednesday, March 25, 2009
  • 60. Scala 20 seconds Wednesday, March 25, 2009
  • 61. Scala Wednesday, March 25, 2009
  • 62. Scala Wednesday, March 25, 2009
  • 63. Scala Wednesday, March 25, 2009
  • 64. Scala Wednesday, March 25, 2009
  • 65. Scala Functional concepts Wednesday, March 25, 2009
  • 66. Scala Wednesday, March 25, 2009
  • 67. Scala Design goals: Embrace immutability Avoid state Wednesday, March 25, 2009
  • 68. Scala Cleaner code Wednesday, March 25, 2009
  • 69. Scala Cleaner code More ne-grained reuse Wednesday, March 25, 2009
  • 70. Scala Cleaner code More ne-grained reuse No Iterator loops needed :-) Wednesday, March 25, 2009
  • 71. Scala Better optimizations Wednesday, March 25, 2009
  • 72. Scala Better optimizations Multi-core! Wednesday, March 25, 2009
  • 73. Scala Better optimizations Multi-core! Lazy evaluation Wednesday, March 25, 2009
  • 74. Scala Better optimizations Multi-core! Lazy evaluation Recursion Wednesday, March 25, 2009
  • 75. Scala What about the functions? Wednesday, March 25, 2009
  • 76. Scala Every operation is a method call Wednesday, March 25, 2009
  • 77. Scala Every operation is a method call 1+3-6 Wednesday, March 25, 2009
  • 78. Scala Every operation is a method call 1+3-6 1.+(3).-(6) Wednesday, March 25, 2009
  • 79. Scala Function nesting Wednesday, March 25, 2009
  • 80. Scala Function nesting def function1(x : Int) = { Wednesday, March 25, 2009
  • 81. Scala Function nesting def function1(x : Int) = { def function2() = { Wednesday, March 25, 2009
  • 82. Scala Function nesting def function1(x : Int) = { def function2() = { println(x) Wednesday, March 25, 2009
  • 83. Scala Function nesting def function1(x : Int) = { def function2() = { println(x) } Wednesday, March 25, 2009
  • 84. Scala Function nesting def function1(x : Int) = { def function2() = { println(x) } function2() Wednesday, March 25, 2009
  • 85. Scala Function nesting def function1(x : Int) = { def function2() = { println(x) } function2() } Wednesday, March 25, 2009
  • 86. Scala First-class functions Wednesday, March 25, 2009
  • 87. Scala First-class functions def foo (cb: ()=>Unit): Unit = { Wednesday, March 25, 2009
  • 88. Scala First-class functions def foo (cb: ()=>Unit): Unit = { while (true) { Wednesday, March 25, 2009
  • 89. Scala First-class functions def foo (cb: ()=>Unit): Unit = { while (true) { cb(); Thread.sleep(1000); Wednesday, March 25, 2009
  • 90. Scala First-class functions def foo (cb: ()=>Unit): Unit = { while (true) { cb(); Thread.sleep(1000); } Wednesday, March 25, 2009
  • 91. Scala First-class functions def foo (cb: ()=>Unit): Unit = { while (true) { cb(); Thread.sleep(1000); } } Wednesday, March 25, 2009
  • 92. Scala First-class functions def foo (cb: ()=>Unit): Unit = { while (true) { cb(); Thread.sleep(1000); } } foo(Unit : println(quot;hiquot;)) Wednesday, March 25, 2009
  • 93. Scala First-class functions in libraries Wednesday, March 25, 2009
  • 94. Scala First-class functions in libraries val numbers = List(2,5,8,9) Wednesday, March 25, 2009
  • 95. Scala First-class functions in libraries val numbers = List(2,5,8,9) numbers.foreach( Wednesday, March 25, 2009
  • 96. Scala First-class functions in libraries val numbers = List(2,5,8,9) numbers.foreach( (x: Int) => print(x) Wednesday, March 25, 2009
  • 97. Scala First-class functions in libraries val numbers = List(2,5,8,9) numbers.foreach( (x: Int) => print(x) ) Wednesday, March 25, 2009
  • 98. Scala Anonymous functions Wednesday, March 25, 2009
  • 99. Scala Anonymous functions ((i:Int, j:Int) => i + j)(3, 4) Wednesday, March 25, 2009
  • 100. Scala Anonymous functions ((i:Int, j:Int) => i + j)(3, 4) Java: int calc(int i, int j){ return i + j; }; calc(3, 4); Wednesday, March 25, 2009
  • 101. Scala Partially applied functions Wednesday, March 25, 2009
  • 102. Scala Partially applied functions def calc(x:Int, y:Int, z:Int)=x+y+z Wednesday, March 25, 2009
  • 103. Scala Partially applied functions def calc(x:Int, y:Int, z:Int)=x+y+z val calcPart = calc(1, _:Int, 3) Wednesday, March 25, 2009
  • 104. Scala Partially applied functions def calc(x:Int, y:Int, z:Int)=x+y+z val calcPart = calc(1, _:Int, 3) calcPart(4) Wednesday, March 25, 2009
  • 105. + Wednesday, March 25, 2009
  • 106. + Wednesday, March 25, 2009
  • 107. + Simple project Wednesday, March 25, 2009
  • 108. + Hello, Wicket World! Wednesday, March 25, 2009
  • 109. + object HelloWorld { def main(args: Array[String]) { println(quot;Hello, world!quot;) } } Wednesday, March 25, 2009
  • 110. + class HelloWorld extends WebApplication { def main(args: Array[String]) { println(quot;Hello, world!quot;) } } Wednesday, March 25, 2009
  • 111. + class HelloWorld extends WebApplication { } Wednesday, March 25, 2009
  • 112. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } Wednesday, March 25, 2009
  • 113. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { } Wednesday, March 25, 2009
  • 114. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { } Wednesday, March 25, 2009
  • 115. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = quot;quot; } Wednesday, March 25, 2009
  • 116. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = quot;quot; val form = new Form(quot;formquot;) } Wednesday, March 25, 2009
  • 117. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = quot;quot; val form = new Form(quot;formquot;) add(form) } Wednesday, March 25, 2009
  • 118. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = quot;quot; val form = new Form(quot;formquot;) add(form) form.add(new TextField(quot;namequot;, } Wednesday, March 25, 2009
  • 119. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = quot;quot; val form = new Form(quot;formquot;) add(form) form.add(new TextField(quot;namequot;, new PropertyModel(this, quot;namequot;))) } Wednesday, March 25, 2009
  • 120. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = quot;quot; val form = new Form(quot;formquot;) add(form) form.add(new TextField(quot;namequot;, new PropertyModel(this, quot;namequot;))) form.add(new Label(quot;helloworldquot;, } Wednesday, March 25, 2009
  • 121. + class HelloWorld extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = quot;quot; val form = new Form(quot;formquot;) add(form) form.add(new TextField(quot;namequot;, new PropertyModel(this, quot;namequot;))) form.add(new Label(quot;helloworldquot;, new PropertyModel(this, quot;namequot;))) } Wednesday, March 25, 2009
  • 122. + <body> <p><b>Hello, Wicket World!</b></p> <form wicket:id=quot;formquot;> What's your name? <br/> <input wicket:id=quot;namequot;/> <input type=quot;submitquot; value = quot;OKquot; /> <p>Your name is: <b><span wicket:id=quot;helloworldquot;/></b> </p> </form> </body> Wednesday, March 25, 2009
  • 123. + Wednesday, March 25, 2009
  • 124. + Wednesday, March 25, 2009
  • 125. ? Wednesday, March 25, 2009
  • 126. + Wednesday, March 25, 2009
  • 127. Wednesday, March 25, 2009
  • 128. EASY REUSABLE NON-INTRUSIVE SAFE EFFICIENT SCALABLE Wednesday, March 25, 2009
  • 129. EASY Wednesday, March 25, 2009
  • 130. EASY POJO-centric Wednesday, March 25, 2009
  • 131. EASY POJO-centric Wednesday, March 25, 2009
  • 132. EASY All code in Java Wednesday, March 25, 2009
  • 133. EASY All code in Java or Scala Wednesday, March 25, 2009
  • 134. EASY Maximum type safety and compile-time problem diagnosis Wednesday, March 25, 2009
  • 135. EASY Maximum type safety and compile-time problem diagnosis Wednesday, March 25, 2009
  • 136. EASY Minimum reliance on special tools Wednesday, March 25, 2009
  • 137. EASY Minimum reliance on special tools Wednesday, March 25, 2009
  • 138. EASY Wednesday, March 25, 2009
  • 139. REUSABLE Wednesday, March 25, 2009
  • 140. REUSABLE Function reuse Wednesday, March 25, 2009
  • 141. REUSABLE Wednesday, March 25, 2009
  • 142. NON-INTRUSIVE Wednesday, March 25, 2009
  • 143. NON-INTRUSIVE HTML or other markup not polluted with programming semantics Wednesday, March 25, 2009
  • 144. NON-INTRUSIVE HTML or other markup not polluted with programming semantics Wednesday, March 25, 2009
  • 145. NON-INTRUSIVE But... Scala != Java Wednesday, March 25, 2009
  • 146. NON-INTRUSIVE ? Wednesday, March 25, 2009
  • 147. SAFE Wednesday, March 25, 2009
  • 148. SAFE Code is secure by default Wednesday, March 25, 2009
  • 149. SAFE Code is secure by default Wednesday, March 25, 2009
  • 150. SAFE All logic in Java (or Scala) with maximum type safety Wednesday, March 25, 2009
  • 151. SAFE All logic in Java (or Scala) with maximum type safety Wednesday, March 25, 2009
  • 152. SAFE Wednesday, March 25, 2009
  • 153. EFFICIENT / SCALABLE Wednesday, March 25, 2009
  • 154. EFFICIENT / SCALABLE Efficient and lightweight Wednesday, March 25, 2009
  • 155. EFFICIENT / SCALABLE Efficient and lightweight Wednesday, March 25, 2009
  • 156. EFFICIENT / SCALABLE Scala means reducing the amount of code. Wednesday, March 25, 2009
  • 157. EFFICIENT / SCALABLE Scala means reducing the amount of code. Wednesday, March 25, 2009
  • 158. EFFICIENT / SCALABLE Wednesday, March 25, 2009
  • 159. Wednesday, March 25, 2009
  • 160. EASY REUSABLE NON-INTRUSIVE SAFE EFFICIENT SCALABLE Wednesday, March 25, 2009
  • 161. Wednesday, March 25, 2009
  • 162. Wednesday, March 25, 2009
  • 163. maven Wednesday, March 25, 2009
  • 164. maven Wednesday, March 25, 2009
  • 165. maven maven-scala-plugin Wednesday, March 25, 2009
  • 166. maven Under <build> <plugins> <plugin> <groupId>org.scala-tools</groupId> <artifactId>maven-scala-plugin</artifactId> <executions> <execution> <goals> <goal>compile</goal>         <goal>testCompile</goal>   </goals> </execution> </executions> Wednesday, March 25, 2009
  • 167. maven Under <pluginRepositories> <pluginRepository> <id>scala</id> <name>Scala Tools</name> <url>http://scala-tools.org/repo-releases</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> Wednesday, March 25, 2009
  • 168. maven Under <repositories> <repository> <id>scala</id> <name>Scala Tools</name> <url>http://scala-tools.org/repo-releases</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> Wednesday, March 25, 2009
  • 169. maven Under <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.7.3</version> </dependency> Wednesday, March 25, 2009
  • 170. maven You can add this to any Java+Maven project! Wednesday, March 25, 2009
  • 171. maven Project layout Wednesday, March 25, 2009
  • 172. maven pom.xml src main java test java Wednesday, March 25, 2009
  • 173. maven pom.xml src main scala test scala Wednesday, March 25, 2009
  • 174. maven pom.xml src main java scala test java scala Wednesday, March 25, 2009
  • 175. maven Hello, Wicket World! built in Maven Wednesday, March 25, 2009
  • 176. maven Wednesday, March 25, 2009
  • 177. maven Wednesday, March 25, 2009
  • 178. Download the demo project. Wednesday, March 25, 2009
  • 179. Java Scala Wednesday, March 25, 2009
  • 180. Java Scala Wednesday, March 25, 2009
  • 181. Java Scala Java interface implemented in Scala Wednesday, March 25, 2009
  • 182. Java Scala public interface SomeInterface { void doSomething(String argument); } Wednesday, March 25, 2009
  • 183. Java Scala public interface SomeInterface { void doSomething(String argument); } class SomeImplementation extends SomeInterface { def doSomething(argument: String):Unit = { println(argument) } } Wednesday, March 25, 2009
  • 184. Java Scala public interface SomeInterface { ? void doSomething(String argument); } class SomeImplementation extends SomeInterface { def doSomething(argument: String):unit = { println(argument) } } Wednesday, March 25, 2009
  • 185. Java Scala Scala does not have interfaces! Wednesday, March 25, 2009
  • 186. Java Scala Scala has traits Wednesday, March 25, 2009
  • 187. Java Scala extending a trait class SomeImplementation extends SomeInterface { def doSomething(argument: String) : unit = { println(argument) } } Wednesday, March 25, 2009
  • 188. Java Scala interface != trait Wednesday, March 25, 2009
  • 189. Java Scala traits can have method implementations Wednesday, March 25, 2009
  • 190. Java Scala public interface SomeInterface { void doSomething(String argument); } trait SomeTrait { def doSomething=(argument:String):Unit } Wednesday, March 25, 2009
  • 191. Java Scala public interface SomeInterface { void doSomething(String argument); } trait SomeTrait { def doSomething(argument:String):Unit   def computeSomething = title.length * 10 } Wednesday, March 25, 2009
  • 192. Java Scala public interface SomeInterface { void doSomething(String argument); } class SomeImplementation extends SomeInterface { def doSomething(argument: String):Unit = { println(argument) } } Wednesday, March 25, 2009
  • 193. Java Scala public interface SomeInterface { void doSomething(String argument); } class SomeImplementation extends SomeInterface { } Wednesday, March 25, 2009
  • 194. Java Scala Error: class SomeImplementation needs to be abstract since method doSomething in trait SomeInterface of type (java.lang.String)Unit is not defined. Wednesday, March 25, 2009
  • 195. Java Scala Java and Scala combined: Circular dependencies Wednesday, March 25, 2009
  • 196. Java Scala Wednesday, March 25, 2009
  • 197. Java Scala public interface SomeInterface { void doSomething(String argument); } Wednesday, March 25, 2009
  • 198. Java Scala public interface SomeInterface { void doSomething(String argument); } class SomeImplementation extends SomeInterface { def doSomething=(argument:String):Unit {...} } Wednesday, March 25, 2009
  • 199. Java Scala public interface SomeInterface { void doSomething(String argument); } class SomeImplementation extends SomeInterface { def doSomething=(argument:String):Unit {...} } public class Other extends SomeImplementation { ... } Wednesday, March 25, 2009
  • 200. Java Scala maven-scala-plugin Wednesday, March 25, 2009
  • 201. Java Scala maven-scala-plugin Handles circular dependencies! Wednesday, March 25, 2009
  • 202. Java Scala How? Wednesday, March 25, 2009
  • 203. Java Scala Wednesday, March 25, 2009
  • 204. Java Scala scalac parses Java code (since 2.7.2) Wednesday, March 25, 2009
  • 205. Java Scala public interface SomeInterface { void doSomething(String argument); } class SomeImplementation extends SomeInterface { def doSomething=(argument:String):Unit {...} } public class Other extends SomeImplementation { ... } Wednesday, March 25, 2009
  • 206. Wednesday, March 25, 2009
  • 207. Wednesday, March 25, 2009
  • 208. Wednesday, March 25, 2009
  • 209. Scala home on the web. Reference manuals, tutorials, news, speci cations. http://www.scala-lang.org Wednesday, March 25, 2009
  • 210. Interpreter, variables, methods, loops, arrays, lists, tuples, sets, maps, classes, singletons, traits, mixins. http://www.artima.com/scalazine/articles/steps.html Wednesday, March 25, 2009
  • 211. Multiple articles covering a feature by feature comparison of Scala and Java http://blogs.sun.com/sundararajan/entry/scala_for_java_programmers Wednesday, March 25, 2009
  • 212. Series of 6 great articles covering a lot of Scala. Aimed at Java developers. http://www.codecommit.com/blog/scala/roundup-scala-for-java-refugees Wednesday, March 25, 2009
  • 213. Scala Wiki. FAQ, code samples, design patterns, Scala job openings http://scala.sygneca.com/ Wednesday, March 25, 2009
  • 214. Official mailing lists Subscribe: empty message to scala-subscribe@listes.ep .ch http://www.scala-lang.org/node/199 Wednesday, March 25, 2009
  • 215. All samples can be downloaded at http://stuq.nl Wednesday, March 25, 2009
  • 216. Get started with Scala and Wicket! Wednesday, March 25, 2009
  • 217. Thanks! Wednesday, March 25, 2009