SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Wicket	
  and	
  Scala	
  

       +
                   Okpala Ikenna N. Jr.
                   bit.ly/ikennaokpala

                   July 27th, 2010
              “Lightening Talk” on Wicket and Scala
+
An	
  Overview	
  	
  
What	
  is	
  

                 ?
• nvented by Martin Odersky.
 I
•  izza Into Java http://bit.ly/cudrM4
 P
•  hen GJ
 T
•  tarted 2001, First release 2003
 S
•  cala Hybrid (Functional and OOP)
 S
Programming Language
•  tatically typed.
 S
•  very value an object (var a = 2)
 E
•  very operation a method call ( 1 + (2))
 E
•  ompiles to java byte code and runs on
 C
the JVM
• println (“Hello, World”)
•  ariable with var or val… encouraging
 V
immutability.
•  ethod with def keyword
 M
• Traits instead of interface
•  attern matching (eg: exceptions)
 P
•  igh Order Function
 H
•  ML easier parsing
 X
•  omain Specific Language(DSL)
 D
Basic Scala Code on REPL:


object Ljc extends Application{ ---------------------- 1
println("Hello, London Java Community!”)
}

val group = “London Java Community” ------------- 2
def ljc (group: String ) :Unit = println(group)

List(3.5, 2.5, 1.5) map(_* 2) -------------3
Basic Scala Code on REPL:
trait LjcTrait { ---------------- 4
def doSomething() {
println(“Which Group is this: “)}
def computeSomething = “London Java Community” .length * 10
}
class Ljc extends LjcTrait {-----------5
override def toString = “London Java Community”
override def dosomething (){
println(“Which Group is this: “+toString+”!”)
}
“Apache Wicket” is component based
Java web framework, originally created
Jonathan Locke In 2004.
Why Wicket ?
- Wicket encourages total separation between plain Java code and HTML, with
the help of meaningful abstractions. (i.e. allows the java code to handle all the
logic)

- Wicket provides excellent support and management of server side state
transparently.

- Very little XML configuration is required to get your web application going. this
is not the case when compared to some other frameworks that are largely
dependent on XML config kind of files.

- And finally, it does not have any special mark up that you would have to learn
afresh (i.e. just HTML tags are marked with a simple and very unnoticeable
“wicket:id” tag, and you are done).
+
Scala Wicket maven archetype @ this address: http://jweekend.co.uk/dev/LegUp



    mvn archetype:generate -B -DarchetypeCatalog=http://
    legup.googlecode.com/svn/repo/archetype-catalog.xml -
    DarchetypeArtifactId=LegUpScalaWicketQuickStart-
    archetype -
    DarchetypeGroupId=com.jweekend.learnscala -
    DarchetypeVersion=0.8.3 -DgroupId=com.mycompany -
    DartifactId=mycompany -Dversion=1.0-SNAPSHOT -
    Dpackage=com.mycompany
+
Basic Wicket and Scala Code:
class LegUp extends WebApplication {
  def getHomePage = classOf[HomePage]
}
class HomePage extends WebPage {
  var name = "Hello!"
  val form = new Form[String]("form")
  add(form)
  form.add(new TextField[String]("nameField", new ToySafeModel[String](name,
{null; name = _})))
  form.add(new Label("nameLabel", new ToySafeModel[String](name , null)))
}
class ToySafeModel[T](accessor: => T, mutator: T => Unit) extends IModel[T]() {
  override def getObject() = accessor
  override def setObject(t: T) = mutator(t)
  override def detach() = Nil
}
+
Basic Wicket and Scala Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   http://java.sun.com/dtd/web-app_2_3.dtd>
<web-app>
  <display-name>Hello, Wicket World!</display-name>
  <filter><filter-name>HelloWicketWorld</filter-name>
     <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
     <init-param><param-name>applicationClassName</param-name>
       <param-value>com.mycompany.LegUp</param-value>
     </init-param>
  </filter>
  <filter-mapping><filter-name>HelloWicketWorld</filter-name>
     <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>
+
Basic Wicket and Scala Code:

  <html>
  <body>
    <p><strong><a href="http://jweekend.com/dev/LegUp">LegUp</a>:
       <a href="http://wicket.apache.org">Wicket</a> on <a href="http://
  scala-lang.org">Scala</a></strong></p>
    <form wicket:id="form">
       <label for="nameField">How do you greet people?</label>
       <input wicket:id="nameField" id="nameField" />
       <input type="submit" value="Submit"/>
       <p wicket:id="nameLabel"></p>
    </form>
  </body>
  </html>
+
Basic Wicket and Scala Code:
+
IDE Support
  clipse and a lot more
 E
  nsime for scala on emacs
 E
 ntelliJ IDEA
 I
  etbeans
 N
  Rebel
 J
THANKS	
  

Mais conteúdo relacionado

Mais procurados

Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developersJohn Stevenson
 
User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014Robert Stupp
 
Scala: Object-Oriented Meets Functional, by Iulian Dragos
Scala: Object-Oriented Meets Functional, by Iulian DragosScala: Object-Oriented Meets Functional, by Iulian Dragos
Scala: Object-Oriented Meets Functional, by Iulian Dragos3Pillar Global
 
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionJava OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionOUM SAOKOSAL
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...GeeksLab Odessa
 
04 Java Language And OOP Part IV
04 Java Language And OOP Part IV04 Java Language And OOP Part IV
04 Java Language And OOP Part IVHari Christian
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24  tricky stuff in java grammar and javacJug trojmiasto 2014.04.24  tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javacAnna Brzezińska
 
TclOO: Past Present Future
TclOO: Past Present FutureTclOO: Past Present Future
TclOO: Past Present FutureDonal Fellows
 
Fun with Functional Programming in Clojure
Fun with Functional Programming in ClojureFun with Functional Programming in Clojure
Fun with Functional Programming in ClojureCodemotion
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To ScalaPeter Maas
 
Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Yardena Meymann
 
Scala for the doubters
Scala for the doubtersScala for the doubters
Scala for the doubtersMax Klyga
 
Android course session 5 (Threads & socket)
Android course session 5 (Threads & socket)Android course session 5 (Threads & socket)
Android course session 5 (Threads & socket)Keroles M.Yakoub
 

Mais procurados (20)

Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developers
 
User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014
 
Java Day-6
Java Day-6Java Day-6
Java Day-6
 
Java Thread
Java ThreadJava Thread
Java Thread
 
Scala: Object-Oriented Meets Functional, by Iulian Dragos
Scala: Object-Oriented Meets Functional, by Iulian DragosScala: Object-Oriented Meets Functional, by Iulian Dragos
Scala: Object-Oriented Meets Functional, by Iulian Dragos
 
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionJava OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - Collection
 
All about scala
All about scalaAll about scala
All about scala
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
 
04 Java Language And OOP Part IV
04 Java Language And OOP Part IV04 Java Language And OOP Part IV
04 Java Language And OOP Part IV
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24  tricky stuff in java grammar and javacJug trojmiasto 2014.04.24  tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
 
TclOO: Past Present Future
TclOO: Past Present FutureTclOO: Past Present Future
TclOO: Past Present Future
 
Java Advanced Features
Java Advanced FeaturesJava Advanced Features
Java Advanced Features
 
Fun with Functional Programming in Clojure
Fun with Functional Programming in ClojureFun with Functional Programming in Clojure
Fun with Functional Programming in Clojure
 
Java Day-3
Java Day-3Java Day-3
Java Day-3
 
scala
scalascala
scala
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
 
Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008
 
Scala for the doubters
Scala for the doubtersScala for the doubters
Scala for the doubters
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
Android course session 5 (Threads & socket)
Android course session 5 (Threads & socket)Android course session 5 (Threads & socket)
Android course session 5 (Threads & socket)
 

Destaque

Scala and Lift presentation
Scala and Lift presentationScala and Lift presentation
Scala and Lift presentationScalac
 
Scala 3camp 2011
Scala   3camp 2011Scala   3camp 2011
Scala 3camp 2011Scalac
 
Liftweb
LiftwebLiftweb
LiftwebScalac
 
Scala == Effective Java
Scala == Effective JavaScala == Effective Java
Scala == Effective JavaScalac
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerLuminary Labs
 

Destaque (10)

Lift
LiftLift
Lift
 
Lift
LiftLift
Lift
 
Scala & Eclipse
Scala & EclipseScala & Eclipse
Scala & Eclipse
 
ORMs in Golang
ORMs in GolangORMs in Golang
ORMs in Golang
 
Scala and Lift presentation
Scala and Lift presentationScala and Lift presentation
Scala and Lift presentation
 
Scala 3camp 2011
Scala   3camp 2011Scala   3camp 2011
Scala 3camp 2011
 
Liftweb
LiftwebLiftweb
Liftweb
 
Scala == Effective Java
Scala == Effective JavaScala == Effective Java
Scala == Effective Java
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 

Semelhante a Short Lightening Talk

Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojureAbbas Raza
 
The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212Mahmoud Samir Fayed
 
Advanced Swift Generics
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift GenericsMax Sokolov
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghStuart Roebuck
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with ClojureJohn Stevenson
 
The craft of meta programming on JVM
The craft of meta programming on JVMThe craft of meta programming on JVM
The craft of meta programming on JVMIgor Khotin
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerDavid Muñoz Díaz
 
The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202Mahmoud Samir Fayed
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin Vasil Remeniuk
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemGuardSquare
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet IntroductionWei Sun
 
What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?ukdpe
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewEric Nelson
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#Talbott Crowell
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
Eclipse Modeling Framework
Eclipse Modeling FrameworkEclipse Modeling Framework
Eclipse Modeling FrameworkAjay K
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007lucclaes
 
Building modular software with OSGi - Ulf Fildebrandt
Building modular software with OSGi - Ulf FildebrandtBuilding modular software with OSGi - Ulf Fildebrandt
Building modular software with OSGi - Ulf Fildebrandtmfrancis
 

Semelhante a Short Lightening Talk (20)

Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212
 
Advanced Swift Generics
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift Generics
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with Clojure
 
The craft of meta programming on JVM
The craft of meta programming on JVMThe craft of meta programming on JVM
The craft of meta programming on JVM
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmer
 
The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 
.NET Vs J2EE
.NET Vs J2EE.NET Vs J2EE
.NET Vs J2EE
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet Introduction
 
What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
Eclipse Modeling Framework
Eclipse Modeling FrameworkEclipse Modeling Framework
Eclipse Modeling Framework
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007
 
Building modular software with OSGi - Ulf Fildebrandt
Building modular software with OSGi - Ulf FildebrandtBuilding modular software with OSGi - Ulf Fildebrandt
Building modular software with OSGi - Ulf Fildebrandt
 

Short Lightening Talk

  • 1. Wicket  and  Scala   + Okpala Ikenna N. Jr. bit.ly/ikennaokpala July 27th, 2010 “Lightening Talk” on Wicket and Scala
  • 4. • nvented by Martin Odersky. I •  izza Into Java http://bit.ly/cudrM4 P •  hen GJ T •  tarted 2001, First release 2003 S •  cala Hybrid (Functional and OOP) S Programming Language •  tatically typed. S •  very value an object (var a = 2) E •  very operation a method call ( 1 + (2)) E •  ompiles to java byte code and runs on C the JVM • println (“Hello, World”) •  ariable with var or val… encouraging V immutability. •  ethod with def keyword M • Traits instead of interface •  attern matching (eg: exceptions) P •  igh Order Function H •  ML easier parsing X •  omain Specific Language(DSL) D
  • 5. Basic Scala Code on REPL: object Ljc extends Application{ ---------------------- 1 println("Hello, London Java Community!”) } val group = “London Java Community” ------------- 2 def ljc (group: String ) :Unit = println(group) List(3.5, 2.5, 1.5) map(_* 2) -------------3
  • 6. Basic Scala Code on REPL: trait LjcTrait { ---------------- 4 def doSomething() { println(“Which Group is this: “)} def computeSomething = “London Java Community” .length * 10 } class Ljc extends LjcTrait {-----------5 override def toString = “London Java Community” override def dosomething (){ println(“Which Group is this: “+toString+”!”) }
  • 7. “Apache Wicket” is component based Java web framework, originally created Jonathan Locke In 2004.
  • 8. Why Wicket ? - Wicket encourages total separation between plain Java code and HTML, with the help of meaningful abstractions. (i.e. allows the java code to handle all the logic) - Wicket provides excellent support and management of server side state transparently. - Very little XML configuration is required to get your web application going. this is not the case when compared to some other frameworks that are largely dependent on XML config kind of files. - And finally, it does not have any special mark up that you would have to learn afresh (i.e. just HTML tags are marked with a simple and very unnoticeable “wicket:id” tag, and you are done).
  • 9. + Scala Wicket maven archetype @ this address: http://jweekend.co.uk/dev/LegUp mvn archetype:generate -B -DarchetypeCatalog=http:// legup.googlecode.com/svn/repo/archetype-catalog.xml - DarchetypeArtifactId=LegUpScalaWicketQuickStart- archetype - DarchetypeGroupId=com.jweekend.learnscala - DarchetypeVersion=0.8.3 -DgroupId=com.mycompany - DartifactId=mycompany -Dversion=1.0-SNAPSHOT - Dpackage=com.mycompany
  • 10. + Basic Wicket and Scala Code: class LegUp extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = "Hello!" val form = new Form[String]("form") add(form) form.add(new TextField[String]("nameField", new ToySafeModel[String](name, {null; name = _}))) form.add(new Label("nameLabel", new ToySafeModel[String](name , null))) } class ToySafeModel[T](accessor: => T, mutator: T => Unit) extends IModel[T]() { override def getObject() = accessor override def setObject(t: T) = mutator(t) override def detach() = Nil }
  • 11. + Basic Wicket and Scala Code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" http://java.sun.com/dtd/web-app_2_3.dtd> <web-app> <display-name>Hello, Wicket World!</display-name> <filter><filter-name>HelloWicketWorld</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param><param-name>applicationClassName</param-name> <param-value>com.mycompany.LegUp</param-value> </init-param> </filter> <filter-mapping><filter-name>HelloWicketWorld</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
  • 12. + Basic Wicket and Scala Code: <html> <body> <p><strong><a href="http://jweekend.com/dev/LegUp">LegUp</a>: <a href="http://wicket.apache.org">Wicket</a> on <a href="http:// scala-lang.org">Scala</a></strong></p> <form wicket:id="form"> <label for="nameField">How do you greet people?</label> <input wicket:id="nameField" id="nameField" /> <input type="submit" value="Submit"/> <p wicket:id="nameLabel"></p> </form> </body> </html>
  • 13. + Basic Wicket and Scala Code:
  • 14. + IDE Support   clipse and a lot more E   nsime for scala on emacs E  ntelliJ IDEA I   etbeans N   Rebel J