SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
Dynamic and rich web
          application using the
             good ol' JVM
                                                                       Daniel López Janáriz
                                                                              Web developer
                                                   Universitat de les Illes Balears (UIB)
December 9th 2010                                    JavaTools Community @ java.net
JavaOne 2010        JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Introduction



   Web applications turned the development world upside
   down.
          Ever changing requirements
          Heterogeneous equipment (client OS, browsers,
            application servers, server OS)
          Heterogeneous teams (programming, designing,
            SEO, accesibility, usability...)
          Development in “web time”
          “Peter Pan” technology
   And then we have to choose...




                         JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Introduction II



    What technology?
           How to choose?
           Which ones to try?
           What is important?
                  Adoption?
                  Compatibility?
                  Background?
           Is there any “magic bullet”?
    That makes our team look like this...




                            JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Introduction III



    How can we improve the situation:
           Learn the various choices you can make so you can
             decide between them
           Adapt your architecture to the web development
             world.
    So, we are here to:
           Showcase some technologies that can be used in
             the Java plattform.
           Demonstrate that an architecture can be adaptable.
    The end goal is that the choice looks like...




                           JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Learning: why the JVM?



   Java is/was popular for a reason. Among other things
         Very good virtual machine
         Tons of libraries, utilities, frameworks, API...
   So, should we start from scratch?
         Sometimes not possible (100% one-step migration)
         Small steps help you move from a safe location to a
           closer safe location.




                           JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Learning: how?



   The JVM is a bytecode interpreter/dynamic compiler
   so...
         Generate compatible bytecode from the new
           language. (ex. Scala)
         Implement in bytecode an interpreter for the new
           language. (ex. BeanShell)
         Combine both solutions. (ex. Groovy)
   The “interpreted” languages can be accessed
         Through a custom API
         Through the Java Scripting API (JSR-232, Java >=6)




                         JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Learning: Java Scripting API


ScriptEngineManager theScriptEngineManager = new ScriptEngineManager();
ScriptEngine theSE = theScriptEngineManager.getEngineByExtension(extension);
Reader reader = ...;
...
// To interpret the script directly
theAnswer = theSE.eval(reader);

// If you call a function inside the script
theSE.eval(reader);
Invocable inv = (Invocable) theSE;
theAnswer = inv.invokeFunction(functionName);




                                  JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Architecture: How to be prepared?



   In order to be able to adapt to different requierements,
   we will use an architecture built around the Separation
   of Concerns (SoC) pattern.
   The overall goal is to have an architecture where the
   different parts communicate through clearly defined
   interfaces, so the don't step into each other toes.
   Using an “opinionated” artechitecture with tight
   integration brings other advantages and drawbacks.




                          JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
But don't go overboard with it or...
… it will look like this:
Architecture: Tiers



    This is the web development SoC
    architecture we have used
    Where we have separated these main
    Concerns:
          User interface
          Presentation logic
          Controller
          Application/business logic
          Persistence




                          JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Architecture: Showcase application


  A simple CRUD application on one table(Items).
  Every “concern” is implemented with different technologies:
        To test if they really can be used independently.
        To find out some of the benefits and drawbacks of each
          alternative.
        To do some mythbusting!




                          JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Showcase: Implementations



   Persistence
           Oracle, HSQLDB
   Business logic
            JDBC, Hibernate, JPA, Ibatis, Groovy(x2), JRuby, JavaScript(x2),
              Jython, Scala, Pnuts, PHP, PL/SQL
   Controller
            WebLEAF
   Presentation logic
            JSP, FreeMarker, XSLT, Groovlets
   User interface
           HTML, RIA: JavaScript (ExtJS, GWT), Flex, Java (Applet, JWS)
   Comunications
           JSON, XML/HTTP, Web Services


                                JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
951
Possibilities!!
( 495 if we exclude the DB)
Application
& business
Logic
App. Logic: Java/JDBC




                        JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
App. Logic: Groovy




                     JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
App. Logic: Jython




                     JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
App. Logic: Scala




                    JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
User
Interface
UI: HTML




           JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
UI: JavaScript RIA




                     JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
UI: Flex RIA




               JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
UI: Java Applet RIA




                      JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
UI: PDF




          JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Etc... (demo)




    http://localhost:8080/

http://www.greeneyed.org/test/




                                 JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Conclusions

 The JVM is not only Java and you don't have to abandon completely the Java
 platform.
 There are many different languages with different styles that are more or less
 useful depending on your needs.
 Learning different approaches to face all the different challenges is the way
 to be prepared.
 SoC architectures are an option to facilitate having different approaches at
 hand, even though it's not the only one and it is not necessarily the best.
 Implementing such an experiment is quite an experience and acts as a
 vaccine against language bigotry.
 Next question is... is any of this really useful in real life?
           We have alredy used it to migrate the business logic from one
             option to another and reduce memory consumption and CPU load
             on the DB to move it to the application server so clustering of
             those elements is more effective.
           We have also used it to modify and “spice up” some UIs with some
             AJAX/JavaScript widgets.

                                JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
Thank you for your attention

           Questions?




           JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/

Mais conteúdo relacionado

Semelhante a Dynamic and rich web application using the good ol\' JVM - Java One Brazil

JavaScript & Enterprise BED-Con 2014 Berlin German
JavaScript & Enterprise BED-Con 2014 Berlin GermanJavaScript & Enterprise BED-Con 2014 Berlin German
JavaScript & Enterprise BED-Con 2014 Berlin GermanAdam Boczek
 
Javamagazine20140304 dl
Javamagazine20140304 dlJavamagazine20140304 dl
Javamagazine20140304 dlVinay H G
 
March april 2014 java magazine
March april 2014   java magazineMarch april 2014   java magazine
March april 2014 java magazineTaline Felix
 
JavaMagazine - Java SE 8 - 2014-03-04
JavaMagazine - Java SE 8 - 2014-03-04JavaMagazine - Java SE 8 - 2014-03-04
JavaMagazine - Java SE 8 - 2014-03-04Erik Gur
 
Learning java from scratch
Learning java from scratchLearning java from scratch
Learning java from scratchActonRoy
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewJosh Padnick
 
TechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb
 
Cross Platform Mobile Technologies
Cross Platform Mobile TechnologiesCross Platform Mobile Technologies
Cross Platform Mobile TechnologiesTalentica Software
 
Understanding Microservices
Understanding MicroservicesUnderstanding Microservices
Understanding Microservicesvguhesan
 
SharePoint Conference North America - Converting your JavaScript to SPFX
SharePoint Conference North America - Converting your JavaScript to SPFXSharePoint Conference North America - Converting your JavaScript to SPFX
SharePoint Conference North America - Converting your JavaScript to SPFXMark Rackley
 
C,c++,java,php,.net training institute in delhi, best training institute for ...
C,c++,java,php,.net training institute in delhi, best training institute for ...C,c++,java,php,.net training institute in delhi, best training institute for ...
C,c++,java,php,.net training institute in delhi, best training institute for ...MCM COmpetitive Classes
 
Beyond The Buzz: Pluggable JavaFX Corporate Applications
Beyond The Buzz: Pluggable JavaFX Corporate ApplicationsBeyond The Buzz: Pluggable JavaFX Corporate Applications
Beyond The Buzz: Pluggable JavaFX Corporate ApplicationsJAX London
 

Semelhante a Dynamic and rich web application using the good ol\' JVM - Java One Brazil (20)

Service worker API
Service worker APIService worker API
Service worker API
 
JavaScript & Enterprise BED-Con 2014 Berlin German
JavaScript & Enterprise BED-Con 2014 Berlin GermanJavaScript & Enterprise BED-Con 2014 Berlin German
JavaScript & Enterprise BED-Con 2014 Berlin German
 
Dean4j@Njug5
Dean4j@Njug5Dean4j@Njug5
Dean4j@Njug5
 
eduhub360
eduhub360eduhub360
eduhub360
 
Javamagazine20140304 dl
Javamagazine20140304 dlJavamagazine20140304 dl
Javamagazine20140304 dl
 
March april 2014 java magazine
March april 2014   java magazineMarch april 2014   java magazine
March april 2014 java magazine
 
JavaMagazine - Java SE 8 - 2014-03-04
JavaMagazine - Java SE 8 - 2014-03-04JavaMagazine - Java SE 8 - 2014-03-04
JavaMagazine - Java SE 8 - 2014-03-04
 
Kumaresan.gopalakrishnan resume
Kumaresan.gopalakrishnan resumeKumaresan.gopalakrishnan resume
Kumaresan.gopalakrishnan resume
 
Learning java from scratch
Learning java from scratchLearning java from scratch
Learning java from scratch
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 
TechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdf
 
Cross Platform Mobile Technologies
Cross Platform Mobile TechnologiesCross Platform Mobile Technologies
Cross Platform Mobile Technologies
 
Imdad resume
Imdad resumeImdad resume
Imdad resume
 
Understanding Microservices
Understanding MicroservicesUnderstanding Microservices
Understanding Microservices
 
SharePoint Conference North America - Converting your JavaScript to SPFX
SharePoint Conference North America - Converting your JavaScript to SPFXSharePoint Conference North America - Converting your JavaScript to SPFX
SharePoint Conference North America - Converting your JavaScript to SPFX
 
Resume & CV
Resume & CVResume & CV
Resume & CV
 
C,c++,java,php,.net training institute in delhi, best training institute for ...
C,c++,java,php,.net training institute in delhi, best training institute for ...C,c++,java,php,.net training institute in delhi, best training institute for ...
C,c++,java,php,.net training institute in delhi, best training institute for ...
 
Resume (English)
Resume (English)Resume (English)
Resume (English)
 
Java 2 computer science.pptx
Java 2 computer science.pptxJava 2 computer science.pptx
Java 2 computer science.pptx
 
Beyond The Buzz: Pluggable JavaFX Corporate Applications
Beyond The Buzz: Pluggable JavaFX Corporate ApplicationsBeyond The Buzz: Pluggable JavaFX Corporate Applications
Beyond The Buzz: Pluggable JavaFX Corporate Applications
 

Último

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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 WorkerThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Dynamic and rich web application using the good ol\' JVM - Java One Brazil

  • 1. Dynamic and rich web application using the good ol' JVM Daniel López Janáriz Web developer Universitat de les Illes Balears (UIB) December 9th 2010 JavaTools Community @ java.net JavaOne 2010 JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 2. Introduction Web applications turned the development world upside down. Ever changing requirements Heterogeneous equipment (client OS, browsers, application servers, server OS) Heterogeneous teams (programming, designing, SEO, accesibility, usability...) Development in “web time” “Peter Pan” technology And then we have to choose... JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 3.
  • 4. Introduction II What technology? How to choose? Which ones to try? What is important? Adoption? Compatibility? Background? Is there any “magic bullet”? That makes our team look like this... JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 5.
  • 6. Introduction III How can we improve the situation: Learn the various choices you can make so you can decide between them Adapt your architecture to the web development world. So, we are here to: Showcase some technologies that can be used in the Java plattform. Demonstrate that an architecture can be adaptable. The end goal is that the choice looks like... JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 7.
  • 8. Learning: why the JVM? Java is/was popular for a reason. Among other things Very good virtual machine Tons of libraries, utilities, frameworks, API... So, should we start from scratch? Sometimes not possible (100% one-step migration) Small steps help you move from a safe location to a closer safe location. JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 9. Learning: how? The JVM is a bytecode interpreter/dynamic compiler so... Generate compatible bytecode from the new language. (ex. Scala) Implement in bytecode an interpreter for the new language. (ex. BeanShell) Combine both solutions. (ex. Groovy) The “interpreted” languages can be accessed Through a custom API Through the Java Scripting API (JSR-232, Java >=6) JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 10. Learning: Java Scripting API ScriptEngineManager theScriptEngineManager = new ScriptEngineManager(); ScriptEngine theSE = theScriptEngineManager.getEngineByExtension(extension); Reader reader = ...; ... // To interpret the script directly theAnswer = theSE.eval(reader); // If you call a function inside the script theSE.eval(reader); Invocable inv = (Invocable) theSE; theAnswer = inv.invokeFunction(functionName); JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 11. Architecture: How to be prepared? In order to be able to adapt to different requierements, we will use an architecture built around the Separation of Concerns (SoC) pattern. The overall goal is to have an architecture where the different parts communicate through clearly defined interfaces, so the don't step into each other toes. Using an “opinionated” artechitecture with tight integration brings other advantages and drawbacks. JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 12. But don't go overboard with it or...
  • 13. … it will look like this:
  • 14. Architecture: Tiers This is the web development SoC architecture we have used Where we have separated these main Concerns: User interface Presentation logic Controller Application/business logic Persistence JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 15. Architecture: Showcase application A simple CRUD application on one table(Items). Every “concern” is implemented with different technologies: To test if they really can be used independently. To find out some of the benefits and drawbacks of each alternative. To do some mythbusting! JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 16. Showcase: Implementations Persistence Oracle, HSQLDB Business logic JDBC, Hibernate, JPA, Ibatis, Groovy(x2), JRuby, JavaScript(x2), Jython, Scala, Pnuts, PHP, PL/SQL Controller WebLEAF Presentation logic JSP, FreeMarker, XSLT, Groovlets User interface HTML, RIA: JavaScript (ExtJS, GWT), Flex, Java (Applet, JWS) Comunications JSON, XML/HTTP, Web Services JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 17. 951 Possibilities!! ( 495 if we exclude the DB)
  • 19. App. Logic: Java/JDBC JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 20. App. Logic: Groovy JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 21. App. Logic: Jython JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 22. App. Logic: Scala JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 24. UI: HTML JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 25. UI: JavaScript RIA JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 26. UI: Flex RIA JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 27. UI: Java Applet RIA JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 28. UI: PDF JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 29. Etc... (demo) http://localhost:8080/ http://www.greeneyed.org/test/ JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 30. Conclusions The JVM is not only Java and you don't have to abandon completely the Java platform. There are many different languages with different styles that are more or less useful depending on your needs. Learning different approaches to face all the different challenges is the way to be prepared. SoC architectures are an option to facilitate having different approaches at hand, even though it's not the only one and it is not necessarily the best. Implementing such an experiment is quite an experience and acts as a vaccine against language bigotry. Next question is... is any of this really useful in real life? We have alredy used it to migrate the business logic from one option to another and reduce memory consumption and CPU load on the DB to move it to the application server so clustering of those elements is more effective. We have also used it to modify and “spice up” some UIs with some AJAX/JavaScript widgets. JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/
  • 31. Thank you for your attention Questions? JavaOneSM Brazil 2010 | Dec. 9th | Sala 3 | 2:00 PM | http://www.oracle.com/br/javaonedevelop/en/