SlideShare a Scribd company logo
1 of 63
Tapestry 5: Java
Power,
Scripting Ease!

Howard M. Lewis Ship

TWD Consulting
hlship@comcast.net

                       1   © 2009 Howard M. Lewis Ship
Howard Lewis Ship


• Creator, Apache Tapestry
• Author, "Tapestry in Action"
• Independent Consultant




                            2    © 2009 Howard M. Lewis Ship
What is Tapestry?




         3      © 2009 Howard M. Lewis Ship
Java
 4     © 2009 Howard M. Lewis Ship
Open
Source
  5   © 2009 Howard M. Lewis Ship
Component
  Based
    6   © 2009 Howard M. Lewis Ship
Developer
 Focused
    7   © 2009 Howard M. Lewis Ship
Concise
   8   © 2009 Howard M. Lewis Ship
Fast!
  9     © 2009 Howard M. Lewis Ship
Mature
  10   © 2009 Howard M. Lewis Ship
Tapestry
Elements
       11   © 2009 Howard M. Lewis Ship
Tapestry Templates



        Login.tml

        <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
          <body>
            <h1>Please Login</h1>
                                                        Login
             <t:form>
                <t:label for="userId"/>
                <t:textfield value="userId"/>
                <br/>
                                                                   form
                <t:label for="password"/>
                <t:passwordfield value="password"/>
                <br/>                                              label
                <input type="submit" value="Login"/>
             </t:form>
           </html>
                                                                 textfield


                                                                   label

                                                                passwordfield


                                        12                                  © 2009 Howard M. Lewis Ship
Page Classes


   Login.tml

   <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
     <body>
       <h1>Please Login</h1>
                                                         Login.java
        <t:form>
           <t:label for="userId"/>                       public class Login
           <t:textfield value="userId"/>                 {
           <br/>                                           @Property
           <t:label for="password"/>                       private String userId;
           <t:passwordfield value="password"/>
           <br/>                                             @Property
           <input type="submit" value="Login"/>              private String password;
        </t:form>
      </html>                                                Object onSuccess()
                                                             {
                                                               …
                                                             }
                                                         }




                                                  13                                    © 2009 Howard M. Lewis Ship
Page Flows

  Login.java                               UserProfile.java

  public class Login                       public class UserProfile
  {                                        {
    @Property                                …
    private String userId;                 }
      @Property
      private String password;

      void onValidate()
      {
        …
      }

      Object onSuccess()
      {
        …

          return UserProfile.class;
      }
  }




                                      14                              © 2009 Howard M. Lewis Ship
Inversion of Control
  Login.java

  public class Login
                                                              Your
                                                              code
  {
    @Property
    private String userId;

      @Property
      private String password;

      …                          Inject IoC
      @Inject
                                 Service
      private Session session;   into field

      @CommitAfter
      Object onSuccess()
      {
        …

          User user = (User) session. …

          user.setLastLogin(new Date());



  }
      }
          return UserProfile.class;
                                                   Tapestry
                                                   Services
                                              15              © 2009 Howard M. Lewis Ship
Meta-Programming
 Login.java

 public class Login                Generate getter & setter
 {
   @Property
   private String userId;

     @Property
     private String password;

     @InjectPage
     private UserProfile userProfilePage;

     …

     @Inject
     private Session session;
                                    Commit Hibernate transaction
     @CommitAfter
     Object onSuccess()
     {
       …

         User user = (User) session. …

         user.setLastLogin(new Date());


         return userProfilePage;
     }
 }



                                                    16             © 2009 Howard M. Lewis Ship
State Management


                    UserProfile.java

                    public class UserProfile
                    {                               Shared global value (any page)
                      @Property
                      @SessionState
   This page only     private UserEntity user;

                        @Property
                        @Persist
                        private Date searchStart;

                    }




                                            17                             © 2009 Howard M. Lewis Ship
Template                             Injections



                  Component      Meta-
     Java Class
                              Programming


                   Message
                   Catalog




                        18                   © 2009 Howard M. Lewis Ship
❝Most software today is very much
like an Egyptian pyramid with
millions of bricks piled on top of each
other, with no structural integrity, but
just done by brute force and
thousands of slaves.❞

Alan Kay, co-designer of the Smalltalk programming
language
                        19                  © 2009 Howard M. Lewis Ship
Developer
Productivity
         20    © 2009 Howard M. Lewis Ship
21   © 2009 Howard M. Lewis Ship
Non-Tapestry Exception Reporting




                          22       © 2009 Howard M. Lewis Ship
Index does not contain a property named 'now'


              Available properties: class,
              componentResources, currentTime




                      23                 © 2009 Howard M. Lewis Ship
24   © 2009 Howard M. Lewis Ship
25   © 2009 Howard M. Lewis Ship
Scaffolding




              26   © 2009 Howard M. Lewis Ship
BoardGame.java

@Entity
public class BoardGame
{
  @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @NonVisual
  private long id;

  @Validate("required")
  private String title;

  private String creator;

  private String publisher;

  private Date published;

  private boolean inPrint;

  @Validate("required")
  @Column(nullable = false)
  private Genre genre;

  @Validate("required")
  @Column(nullable = false)
  private Theme theme;

  @Validate("min=1")
  private Integer minPlayers;

  @Validate("min=1")
  private Integer maxPlayers;

  @Validate("min=1,max=5")
  private Integer rating;

  @DataType("longtext")
  private String notes;


                                          27                           © 2009 Howard M. Lewis Ship
28   © 2009 Howard M. Lewis Ship
Parameters
    Property Types




                             BeanEditForm
    Naming Conventions



     Annotations



        Explicit Overrides



Localized Messages

                                            29   © 2009 Howard M. Lewis Ship
Feedback &
Exploration


              30   © 2009 Howard M. Lewis Ship
Flow




31    © 2009 Howard M. Lewis Ship
❝PHP and Rails have taught us that
development speed is more important
than we thought it was ... you really
don’t understand a feature till you’ve
built it, so the faster you can build
them the faster you understand
them.❞

Tim Bray, Director of Web Technologies, Sun
Microsystems
                        32                    © 2009 Howard M. Lewis Ship
Internationalization




         33      © 2009 Howard M. Lewis Ship
34   © 2009 Howard M. Lewis Ship
Index_de.properties

page-title=Erstellen Sie eine neue Brettspiel
add-game=Spiel hinzufŸgen

modern=Modernen                     Index.tml
medieval=Mittelalter
bible=Bibel                         <html t:type="layout" title="message:page-title"
abstract=Zusammenfassung              xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
                                      xmlns:p="tapestry:parameter">
war_game=Kriegsspiel
card=Karte                           <t:beaneditform submitlabel="message:add-game" object="game"/>
role_playing=Rollenspiele           </html>
cooperative=Genossenschaft

creator-label=Schšpfer
publisher-label=Verlag
published-label=Veršffentlicht
inprint-label=Im Druck
theme-label=Thema
minplayers-label=Mindest-Spieler
maxplayers-label=Maximale Spieler
notes-label=Notation




                                                   35                                   © 2009 Howard M. Lewis Ship
Tapestry
Components




       36    © 2009 Howard M. Lewis Ship
Nested Components
                                                                     Layout
                                                                   title : String
Layout.tml
                                                                 pageNames : List
                                                                pageName : String
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
  xmlns:p="tapestry:parameter">
  <head>
    <title>${title}</title>
  </head>
  <body>
  …
    <div id="menu">
    <ul>
      <li t:type="loop" source="pageNames" value="pageName"
          class="prop:classForPageName">
        <t:pagelink page="prop:pageName">${pageName}</t:pagelink>   Index
      </li>
    </ul>
  </div>
                                                                    Layout
   …



                                                             Loop             PageLink

                                          37                                  © 2009 Howard M. Lewis Ship
Component Parameters

   Layout.java


   public class Layout
   {
     /** The page title, for the <title> element and the <h1> element. */
     @Property
     @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
     private String title;

      @Property
      @Parameter(defaultPrefix = BindingConstants.LITERAL)
      private String sidebarTitle;

      @Property
      @Parameter(defaultPrefix = BindingConstants.LITERAL)
      private Block sidebar;

      @Property
      private String pageName;




                                        38                            © 2009 Howard M. Lewis Ship
Non-Template Components



  OutputDate.java


  public class OutputDate
  {
    private final DateFormat formatter =
      DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);

      @Parameter(required = true, allowNull = false)
      private Date date;

      void beginRender(MarkupWriter writer)
      {
        writer.write(formatter.format(date));
      }
  }




                                          39                           © 2009 Howard M. Lewis Ship
40   © 2009 Howard M. Lewis Ship
Tapestry
Performance




        41    © 2009 Howard M. Lewis Ship
Request
Processing
Speed




             42   © 2009 Howard M. Lewis Ship
Java
== Fast
   43   © 2009 Howard M. Lewis Ship
No
Reflection
    44   © 2009 Howard M. Lewis Ship
Page
Pooling
   45   © 2009 Howard M. Lewis Ship
GZIP
Compression
     46   © 2009 Howard M. Lewis Ship
Scalability
47          © 2009 Howard M. Lewis Ship
JavaScript
Aggregation
     48   © 2009 Howard M. Lewis Ship
Far Future
 Expires
 Header
    49   © 2009 Howard M. Lewis Ship
Versioned
  URLs
    50   © 2009 Howard M. Lewis Ship
Content
Delivery
Network
   51      © 2009 Howard M. Lewis Ship
❝Architecture is the decisions that you
wish you could get right early in a
project.❞



Martin Fowler, Chief Scientist, ThoughtWorks
                        52                     © 2009 Howard M. Lewis Ship
Conclusion




         53   © 2009 Howard M. Lewis Ship
54   © 2009 Howard M. Lewis Ship
Infrastructure




            55   © 2009 Howard M. Lewis Ship
Performance




          56   © 2009 Howard M. Lewis Ship
Tapestry: The Expert is
Built In




            57      © 2009 Howard M. Lewis Ship
Tapestry 5 In Production




                      58   © 2009 Howard M. Lewis Ship
http://tapestry.apache.org




       59           © 2009 Howard M. Lewis Ship
http://tapestry.formos.com




        60          © 2009 Howard M. Lewis Ship
http://howardlewisship.com




    Tapestry 5 Development and Support
   On-site / Hands-on Tapestry Training
                    hlship@comcast.net
            61                  © 2009 Howard M. Lewis Ship
Image Credits
   © 2006 Chris Walton
   http://www.flickr.com/photos/philocrites/245011706/

                                                © 2009 Nataline Fung
                  http://www.flickr.com/photos/metaphora/3384569933/
   © 2006 Martino Sabia
   http://www.flickr.com/photos/ezu/297634534/
                                                 © 2008 Alan Grinberg
                   http://www.flickr.com/photos/agrinberg/2465119180/
   © 2008 Manu Gómez
   http://www.flickr.com/photos/manugomi/2884678938/
                                                  © 2006 Tom Magliery
                      http://www.flickr.com/photos/mag3737/267638148/
   © 2003 A. Lipson
   http://www.andrewlipson.com/escher/relativity.html

                                                      © 2009 viernest
                    http://www.flickr.com/photos/viernest/3380560365/
   © 2007 Jojo Cence
   http://www.flickr.com/photos/jojocence/1372693375/

                                                © 2007 Patrick Dirden
                     http://www.flickr.com/photos/sp8254/2052236004/
   © 2009 Dani Ihtatho
   http://www.flickr.com/photos/ihtatho/627226315/


                                     62                                 © 2009 Howard M. Lewis Ship
Image Credits
   © 2008 Christophe Delaere
   http://www.flickr.com/photos/delaere/2514143242/

                                         © 2007 Marina Campos Vinhal
                http://www.flickr.com/photos/marinacvinhal/379111290/
   © 2006 kris247
   http://www.flickr.com/photos/kris247/86924080/




                                    63                                 © 2009 Howard M. Lewis Ship

More Related Content

What's hot

fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
Kostas Mavridis
 
Jquery dojo slides
Jquery dojo slidesJquery dojo slides
Jquery dojo slides
helenmga
 
Designing a JavaFX Mobile application
Designing a JavaFX Mobile applicationDesigning a JavaFX Mobile application
Designing a JavaFX Mobile application
Fabrizio Giudici
 
Introduction To Dojo
Introduction To DojoIntroduction To Dojo
Introduction To Dojo
yoavrubin
 
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
Carles Farré
 

What's hot (18)

Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
 
Jquery dojo slides
Jquery dojo slidesJquery dojo slides
Jquery dojo slides
 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Java script
Java scriptJava script
Java script
 
Jquery
JqueryJquery
Jquery
 
Designing a JavaFX Mobile application
Designing a JavaFX Mobile applicationDesigning a JavaFX Mobile application
Designing a JavaFX Mobile application
 
Java script
Java scriptJava script
Java script
 
CSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+ReflectionCSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+Reflection
 
Javascript
JavascriptJavascript
Javascript
 
Model Driven Software Development - Data Model Evolution
Model Driven Software Development - Data Model EvolutionModel Driven Software Development - Data Model Evolution
Model Driven Software Development - Data Model Evolution
 
Spring Web Services
Spring Web ServicesSpring Web Services
Spring Web Services
 
Jsonix - Talking to OGC Web Services in JSON
Jsonix - Talking to OGC Web Services in JSONJsonix - Talking to OGC Web Services in JSON
Jsonix - Talking to OGC Web Services in JSON
 
Introduction To Dojo
Introduction To DojoIntroduction To Dojo
Introduction To Dojo
 
What's new in DWR version 3
What's new in DWR version 3What's new in DWR version 3
What's new in DWR version 3
 
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 

Viewers also liked

The Bayeux Tapestry (complete)
The Bayeux Tapestry (complete)The Bayeux Tapestry (complete)
The Bayeux Tapestry (complete)
anthony_morgan
 
Touch screen technology-bharadwaj
Touch screen technology-bharadwajTouch screen technology-bharadwaj
Touch screen technology-bharadwaj
dhiru8342
 
Napster and Mp3: Redefining the music industry
Napster and Mp3: Redefining the music industryNapster and Mp3: Redefining the music industry
Napster and Mp3: Redefining the music industry
Puneet Arora
 
Touchless technology Seminar Presentation
Touchless technology Seminar PresentationTouchless technology Seminar Presentation
Touchless technology Seminar Presentation
Aparna Nk
 

Viewers also liked (20)

Tapestry In Action For Real
Tapestry In Action For RealTapestry In Action For Real
Tapestry In Action For Real
 
Tapestry: State of the Union
Tapestry: State of the UnionTapestry: State of the Union
Tapestry: State of the Union
 
Tapestry it is simple
Tapestry it is simpleTapestry it is simple
Tapestry it is simple
 
The Bayeux Tapestry (complete)
The Bayeux Tapestry (complete)The Bayeux Tapestry (complete)
The Bayeux Tapestry (complete)
 
Presentation on mini dictionary using C language
Presentation on  mini dictionary using C languagePresentation on  mini dictionary using C language
Presentation on mini dictionary using C language
 
The Flint Michigan Water Crisis: Causes & Effects
The Flint Michigan Water Crisis: Causes & EffectsThe Flint Michigan Water Crisis: Causes & Effects
The Flint Michigan Water Crisis: Causes & Effects
 
Bio Chip Presentation
Bio Chip PresentationBio Chip Presentation
Bio Chip Presentation
 
Touch screen technology
Touch screen technologyTouch screen technology
Touch screen technology
 
Touchscreen technology
Touchscreen technologyTouchscreen technology
Touchscreen technology
 
Touch screen technology-bharadwaj
Touch screen technology-bharadwajTouch screen technology-bharadwaj
Touch screen technology-bharadwaj
 
Biochips seminar
Biochips seminarBiochips seminar
Biochips seminar
 
Touchscreen technology
Touchscreen technologyTouchscreen technology
Touchscreen technology
 
Water scarcity
Water scarcityWater scarcity
Water scarcity
 
Touchless Touchscreen Technology
Touchless Touchscreen TechnologyTouchless Touchscreen Technology
Touchless Touchscreen Technology
 
Touchless Touchscreen
Touchless TouchscreenTouchless Touchscreen
Touchless Touchscreen
 
Napster and Mp3: Redefining the music industry
Napster and Mp3: Redefining the music industryNapster and Mp3: Redefining the music industry
Napster and Mp3: Redefining the music industry
 
Touch Screen Technology PRESENTATION
Touch Screen Technology PRESENTATIONTouch Screen Technology PRESENTATION
Touch Screen Technology PRESENTATION
 
Touchless technology Seminar Presentation
Touchless technology Seminar PresentationTouchless technology Seminar Presentation
Touchless technology Seminar Presentation
 
Seminar report on paper battery
Seminar report on paper batterySeminar report on paper battery
Seminar report on paper battery
 
Comparing JVM Web Frameworks - Jfokus 2012
Comparing JVM Web Frameworks - Jfokus 2012Comparing JVM Web Frameworks - Jfokus 2012
Comparing JVM Web Frameworks - Jfokus 2012
 

Similar to Tapestry 5: Java Power, Scripting Ease

Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
Staples
 
Programming services-slides
Programming services-slidesProgramming services-slides
Programming services-slides
MasterCode.vn
 
Spring 3: What's New
Spring 3: What's NewSpring 3: What's New
Spring 3: What's New
Ted Pennings
 
Integrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight ApplicationsIntegrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight Applications
Dan Wahlin
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
baygross
 

Similar to Tapestry 5: Java Power, Scripting Ease (20)

A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NET
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
 
softshake 2014 - Java EE
softshake 2014 - Java EEsoftshake 2014 - Java EE
softshake 2014 - Java EE
 
The state of your own hypertext preprocessor
The state of your own hypertext preprocessorThe state of your own hypertext preprocessor
The state of your own hypertext preprocessor
 
Programming services-slides
Programming services-slidesProgramming services-slides
Programming services-slides
 
A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NET
 
WebDSL
WebDSLWebDSL
WebDSL
 
Spring 3: What's New
Spring 3: What's NewSpring 3: What's New
Spring 3: What's New
 
Integrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight ApplicationsIntegrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight Applications
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
 
Codemotion appengine
Codemotion appengineCodemotion appengine
Codemotion appengine
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Realm mobile database
Realm mobile databaseRealm mobile database
Realm mobile database
 
Creating an Uber Clone - Part XII.pdf
Creating an Uber Clone - Part XII.pdfCreating an Uber Clone - Part XII.pdf
Creating an Uber Clone - Part XII.pdf
 
NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020
 
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
 
Vasyl Aleksashyn "How to Stop Shooting Yourself in the Foot"
Vasyl Aleksashyn "How to Stop Shooting Yourself in the Foot"Vasyl Aleksashyn "How to Stop Shooting Yourself in the Foot"
Vasyl Aleksashyn "How to Stop Shooting Yourself in the Foot"
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
 
create-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdfcreate-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdf
 

More from Howard Lewis Ship

Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHave Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Howard Lewis Ship
 

More from Howard Lewis Ship (15)

Testing Web Applications with GEB
Testing Web Applications with GEBTesting Web Applications with GEB
Testing Web Applications with GEB
 
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestSpock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
 
Backbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserBackbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The Browser
 
Modern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapModern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter Bootstrap
 
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHave Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
 
Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)
Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)
Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)
 
Arduino: Open Source Hardware Hacking from the Software Nerd Perspective
Arduino: Open Source Hardware Hacking from the Software Nerd PerspectiveArduino: Open Source Hardware Hacking from the Software Nerd Perspective
Arduino: Open Source Hardware Hacking from the Software Nerd Perspective
 
Practical Clojure Programming
Practical Clojure ProgrammingPractical Clojure Programming
Practical Clojure Programming
 
Clojure: Towards The Essence of Programming
Clojure: Towards The Essence of ProgrammingClojure: Towards The Essence of Programming
Clojure: Towards The Essence of Programming
 
Codemash-Clojure.pdf
Codemash-Clojure.pdfCodemash-Clojure.pdf
Codemash-Clojure.pdf
 
Brew up a Rich Web Application with Cappuccino
Brew up a Rich Web Application with CappuccinoBrew up a Rich Web Application with Cappuccino
Brew up a Rich Web Application with Cappuccino
 
Clojure Deep Dive
Clojure Deep DiveClojure Deep Dive
Clojure Deep Dive
 
Clojure: Functional Concurrency for the JVM (presented at OSCON)
Clojure: Functional Concurrency for the JVM (presented at OSCON)Clojure: Functional Concurrency for the JVM (presented at OSCON)
Clojure: Functional Concurrency for the JVM (presented at OSCON)
 
Cascade
CascadeCascade
Cascade
 
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

Tapestry 5: Java Power, Scripting Ease

  • 1. Tapestry 5: Java Power, Scripting Ease! Howard M. Lewis Ship TWD Consulting hlship@comcast.net 1 © 2009 Howard M. Lewis Ship
  • 2. Howard Lewis Ship • Creator, Apache Tapestry • Author, "Tapestry in Action" • Independent Consultant 2 © 2009 Howard M. Lewis Ship
  • 3. What is Tapestry? 3 © 2009 Howard M. Lewis Ship
  • 4. Java 4 © 2009 Howard M. Lewis Ship
  • 5. Open Source 5 © 2009 Howard M. Lewis Ship
  • 6. Component Based 6 © 2009 Howard M. Lewis Ship
  • 7. Developer Focused 7 © 2009 Howard M. Lewis Ship
  • 8. Concise 8 © 2009 Howard M. Lewis Ship
  • 9. Fast! 9 © 2009 Howard M. Lewis Ship
  • 10. Mature 10 © 2009 Howard M. Lewis Ship
  • 11. Tapestry Elements 11 © 2009 Howard M. Lewis Ship
  • 12. Tapestry Templates Login.tml <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"> <body> <h1>Please Login</h1> Login <t:form> <t:label for="userId"/> <t:textfield value="userId"/> <br/> form <t:label for="password"/> <t:passwordfield value="password"/> <br/> label <input type="submit" value="Login"/> </t:form> </html> textfield label passwordfield 12 © 2009 Howard M. Lewis Ship
  • 13. Page Classes Login.tml <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"> <body> <h1>Please Login</h1> Login.java <t:form> <t:label for="userId"/> public class Login <t:textfield value="userId"/> { <br/> @Property <t:label for="password"/> private String userId; <t:passwordfield value="password"/> <br/> @Property <input type="submit" value="Login"/> private String password; </t:form> </html> Object onSuccess() { … } } 13 © 2009 Howard M. Lewis Ship
  • 14. Page Flows Login.java UserProfile.java public class Login public class UserProfile { { @Property … private String userId; } @Property private String password; void onValidate() { … } Object onSuccess() { … return UserProfile.class; } } 14 © 2009 Howard M. Lewis Ship
  • 15. Inversion of Control Login.java public class Login Your code { @Property private String userId; @Property private String password; … Inject IoC @Inject Service private Session session; into field @CommitAfter Object onSuccess() { … User user = (User) session. … user.setLastLogin(new Date()); } } return UserProfile.class; Tapestry Services 15 © 2009 Howard M. Lewis Ship
  • 16. Meta-Programming Login.java public class Login Generate getter & setter { @Property private String userId; @Property private String password; @InjectPage private UserProfile userProfilePage; … @Inject private Session session; Commit Hibernate transaction @CommitAfter Object onSuccess() { … User user = (User) session. … user.setLastLogin(new Date()); return userProfilePage; } } 16 © 2009 Howard M. Lewis Ship
  • 17. State Management UserProfile.java public class UserProfile { Shared global value (any page) @Property @SessionState This page only private UserEntity user; @Property @Persist private Date searchStart; } 17 © 2009 Howard M. Lewis Ship
  • 18. Template Injections Component Meta- Java Class Programming Message Catalog 18 © 2009 Howard M. Lewis Ship
  • 19. ❝Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves.❞ Alan Kay, co-designer of the Smalltalk programming language 19 © 2009 Howard M. Lewis Ship
  • 20. Developer Productivity 20 © 2009 Howard M. Lewis Ship
  • 21. 21 © 2009 Howard M. Lewis Ship
  • 22. Non-Tapestry Exception Reporting 22 © 2009 Howard M. Lewis Ship
  • 23. Index does not contain a property named 'now' Available properties: class, componentResources, currentTime 23 © 2009 Howard M. Lewis Ship
  • 24. 24 © 2009 Howard M. Lewis Ship
  • 25. 25 © 2009 Howard M. Lewis Ship
  • 26. Scaffolding 26 © 2009 Howard M. Lewis Ship
  • 27. BoardGame.java @Entity public class BoardGame { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @NonVisual private long id; @Validate("required") private String title; private String creator; private String publisher; private Date published; private boolean inPrint; @Validate("required") @Column(nullable = false) private Genre genre; @Validate("required") @Column(nullable = false) private Theme theme; @Validate("min=1") private Integer minPlayers; @Validate("min=1") private Integer maxPlayers; @Validate("min=1,max=5") private Integer rating; @DataType("longtext") private String notes; 27 © 2009 Howard M. Lewis Ship
  • 28. 28 © 2009 Howard M. Lewis Ship
  • 29. Parameters Property Types BeanEditForm Naming Conventions Annotations Explicit Overrides Localized Messages 29 © 2009 Howard M. Lewis Ship
  • 30. Feedback & Exploration 30 © 2009 Howard M. Lewis Ship
  • 31. Flow 31 © 2009 Howard M. Lewis Ship
  • 32. ❝PHP and Rails have taught us that development speed is more important than we thought it was ... you really don’t understand a feature till you’ve built it, so the faster you can build them the faster you understand them.❞ Tim Bray, Director of Web Technologies, Sun Microsystems 32 © 2009 Howard M. Lewis Ship
  • 33. Internationalization 33 © 2009 Howard M. Lewis Ship
  • 34. 34 © 2009 Howard M. Lewis Ship
  • 35. Index_de.properties page-title=Erstellen Sie eine neue Brettspiel add-game=Spiel hinzufŸgen modern=Modernen Index.tml medieval=Mittelalter bible=Bibel <html t:type="layout" title="message:page-title" abstract=Zusammenfassung xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> war_game=Kriegsspiel card=Karte <t:beaneditform submitlabel="message:add-game" object="game"/> role_playing=Rollenspiele </html> cooperative=Genossenschaft creator-label=Schšpfer publisher-label=Verlag published-label=Veršffentlicht inprint-label=Im Druck theme-label=Thema minplayers-label=Mindest-Spieler maxplayers-label=Maximale Spieler notes-label=Notation 35 © 2009 Howard M. Lewis Ship
  • 36. Tapestry Components 36 © 2009 Howard M. Lewis Ship
  • 37. Nested Components Layout title : String Layout.tml pageNames : List pageName : String <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> <head> <title>${title}</title> </head> <body> … <div id="menu"> <ul> <li t:type="loop" source="pageNames" value="pageName" class="prop:classForPageName"> <t:pagelink page="prop:pageName">${pageName}</t:pagelink> Index </li> </ul> </div> Layout … Loop PageLink 37 © 2009 Howard M. Lewis Ship
  • 38. Component Parameters Layout.java public class Layout { /** The page title, for the <title> element and the <h1> element. */ @Property @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) private String title; @Property @Parameter(defaultPrefix = BindingConstants.LITERAL) private String sidebarTitle; @Property @Parameter(defaultPrefix = BindingConstants.LITERAL) private Block sidebar; @Property private String pageName; 38 © 2009 Howard M. Lewis Ship
  • 39. Non-Template Components OutputDate.java public class OutputDate { private final DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); @Parameter(required = true, allowNull = false) private Date date; void beginRender(MarkupWriter writer) { writer.write(formatter.format(date)); } } 39 © 2009 Howard M. Lewis Ship
  • 40. 40 © 2009 Howard M. Lewis Ship
  • 41. Tapestry Performance 41 © 2009 Howard M. Lewis Ship
  • 42. Request Processing Speed 42 © 2009 Howard M. Lewis Ship
  • 43. Java == Fast 43 © 2009 Howard M. Lewis Ship
  • 44. No Reflection 44 © 2009 Howard M. Lewis Ship
  • 45. Page Pooling 45 © 2009 Howard M. Lewis Ship
  • 46. GZIP Compression 46 © 2009 Howard M. Lewis Ship
  • 47. Scalability 47 © 2009 Howard M. Lewis Ship
  • 48. JavaScript Aggregation 48 © 2009 Howard M. Lewis Ship
  • 49. Far Future Expires Header 49 © 2009 Howard M. Lewis Ship
  • 50. Versioned URLs 50 © 2009 Howard M. Lewis Ship
  • 51. Content Delivery Network 51 © 2009 Howard M. Lewis Ship
  • 52. ❝Architecture is the decisions that you wish you could get right early in a project.❞ Martin Fowler, Chief Scientist, ThoughtWorks 52 © 2009 Howard M. Lewis Ship
  • 53. Conclusion 53 © 2009 Howard M. Lewis Ship
  • 54. 54 © 2009 Howard M. Lewis Ship
  • 55. Infrastructure 55 © 2009 Howard M. Lewis Ship
  • 56. Performance 56 © 2009 Howard M. Lewis Ship
  • 57. Tapestry: The Expert is Built In 57 © 2009 Howard M. Lewis Ship
  • 58. Tapestry 5 In Production 58 © 2009 Howard M. Lewis Ship
  • 59. http://tapestry.apache.org 59 © 2009 Howard M. Lewis Ship
  • 60. http://tapestry.formos.com 60 © 2009 Howard M. Lewis Ship
  • 61. http://howardlewisship.com Tapestry 5 Development and Support On-site / Hands-on Tapestry Training hlship@comcast.net 61 © 2009 Howard M. Lewis Ship
  • 62. Image Credits © 2006 Chris Walton http://www.flickr.com/photos/philocrites/245011706/ © 2009 Nataline Fung http://www.flickr.com/photos/metaphora/3384569933/ © 2006 Martino Sabia http://www.flickr.com/photos/ezu/297634534/ © 2008 Alan Grinberg http://www.flickr.com/photos/agrinberg/2465119180/ © 2008 Manu Gómez http://www.flickr.com/photos/manugomi/2884678938/ © 2006 Tom Magliery http://www.flickr.com/photos/mag3737/267638148/ © 2003 A. Lipson http://www.andrewlipson.com/escher/relativity.html © 2009 viernest http://www.flickr.com/photos/viernest/3380560365/ © 2007 Jojo Cence http://www.flickr.com/photos/jojocence/1372693375/ © 2007 Patrick Dirden http://www.flickr.com/photos/sp8254/2052236004/ © 2009 Dani Ihtatho http://www.flickr.com/photos/ihtatho/627226315/ 62 © 2009 Howard M. Lewis Ship
  • 63. Image Credits © 2008 Christophe Delaere http://www.flickr.com/photos/delaere/2514143242/ © 2007 Marina Campos Vinhal http://www.flickr.com/photos/marinacvinhal/379111290/ © 2006 kris247 http://www.flickr.com/photos/kris247/86924080/ 63 © 2009 Howard M. Lewis Ship