SlideShare a Scribd company logo
1 of 15
Download to read 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	
  

More Related Content

What's hot

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
 

What's hot (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)
 

Similar to Ikenna Okpala: London Java Community: Wicket and Scala - 27/07/2010.

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
 

Similar to Ikenna Okpala: London Java Community: Wicket and Scala - 27/07/2010. (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
 

More from Skills Matter

5 things cucumber is bad at by Richard Lawrence
5 things cucumber is bad at by Richard Lawrence5 things cucumber is bad at by Richard Lawrence
5 things cucumber is bad at by Richard LawrenceSkills Matter
 
Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applicationsSkills Matter
 
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvmScala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvmSkills Matter
 
Oscar reiken jr on our success at manheim
Oscar reiken jr on our success at manheimOscar reiken jr on our success at manheim
Oscar reiken jr on our success at manheimSkills Matter
 
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Skills Matter
 
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc ian dees on elixir, erlang, and cucumberlCukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc ian dees on elixir, erlang, and cucumberlSkills Matter
 
Cukeup nyc peter bell on getting started with cucumber.js
Cukeup nyc peter bell on getting started with cucumber.jsCukeup nyc peter bell on getting started with cucumber.js
Cukeup nyc peter bell on getting started with cucumber.jsSkills Matter
 
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...Skills Matter
 
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...Skills Matter
 
Progressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source worldProgressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source worldSkills Matter
 
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...Skills Matter
 
Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Skills Matter
 
A poet's guide_to_acceptance_testing
A poet's guide_to_acceptance_testingA poet's guide_to_acceptance_testing
A poet's guide_to_acceptance_testingSkills Matter
 
Russ miles-cloudfoundry-deep-dive
Russ miles-cloudfoundry-deep-diveRuss miles-cloudfoundry-deep-dive
Russ miles-cloudfoundry-deep-diveSkills Matter
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSkills Matter
 
I went to_a_communications_workshop_and_they_t
I went to_a_communications_workshop_and_they_tI went to_a_communications_workshop_and_they_t
I went to_a_communications_workshop_and_they_tSkills Matter
 

More from Skills Matter (20)

5 things cucumber is bad at by Richard Lawrence
5 things cucumber is bad at by Richard Lawrence5 things cucumber is bad at by Richard Lawrence
5 things cucumber is bad at by Richard Lawrence
 
Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applications
 
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvmScala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
 
Oscar reiken jr on our success at manheim
Oscar reiken jr on our success at manheimOscar reiken jr on our success at manheim
Oscar reiken jr on our success at manheim
 
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
 
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc ian dees on elixir, erlang, and cucumberlCukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc ian dees on elixir, erlang, and cucumberl
 
Cukeup nyc peter bell on getting started with cucumber.js
Cukeup nyc peter bell on getting started with cucumber.jsCukeup nyc peter bell on getting started with cucumber.js
Cukeup nyc peter bell on getting started with cucumber.js
 
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
 
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
 
Progressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source worldProgressive f# tutorials nyc don syme on keynote f# in the open source world
Progressive f# tutorials nyc don syme on keynote f# in the open source world
 
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
 
Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#
 
A poet's guide_to_acceptance_testing
A poet's guide_to_acceptance_testingA poet's guide_to_acceptance_testing
A poet's guide_to_acceptance_testing
 
Russ miles-cloudfoundry-deep-dive
Russ miles-cloudfoundry-deep-diveRuss miles-cloudfoundry-deep-dive
Russ miles-cloudfoundry-deep-dive
 
Serendipity-neo4j
Serendipity-neo4jSerendipity-neo4j
Serendipity-neo4j
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelism
 
Plug 20110217
Plug   20110217Plug   20110217
Plug 20110217
 
Lug presentation
Lug presentationLug presentation
Lug presentation
 
I went to_a_communications_workshop_and_they_t
I went to_a_communications_workshop_and_they_tI went to_a_communications_workshop_and_they_t
I went to_a_communications_workshop_and_they_t
 
Plug saiku
Plug   saikuPlug   saiku
Plug saiku
 

Ikenna Okpala: London Java Community: Wicket and Scala - 27/07/2010.

  • 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