0
Dynamic and rich web application using the good ol' JVM
Introduction <ul><li>Web applications turned the development world upside down. </li><ul><li>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 </li></ul><li>And then we have to choose... </li></ul>
 
Introduction II <ul><li>What technology? </li><ul><li>How to choose?
Which ones to try?
What is important? </li><ul><li>Adoption?
Compatibility?
Background? </li></ul><li>Is there any “ magic bullet ”? </li></ul><li>That makes our team look like this... </li></ul>
 
Introduction III <ul><li>How can we improve the situation: </li><ul><li>Learn  the various choices you can make so you can...
Adapt  your architecture to the web development world. </li></ul><li>So, we are here to: </li><ul><li>Showcase some techno...
Demonstrate that an architecture can be adaptable. </li></ul><li>The end goal is that the choice looks like... </li></ul>
 
Learning: why the JVM? <ul><li>Java is/was popular for a reason. Among other things </li><ul><li>Very good virtual machine
Tons of libraries, utilities, frameworks, API... </li></ul><li>So, should we start from scratch? </li><ul><li>Sometimes no...
Small steps help you move from a safe location to a closer safe location. </li></ul></ul>
Learning: how? <ul><li>The JVM is a bytecode interpreter/dynamic compiler so... </li><ul><li>Generate compatible bytecode ...
Implement in bytecode an interpreter for the new language. (ex. BeanShell)
Combine both solutions. (ex. Groovy) </li></ul><li>The “interpreted” languages can be accessed </li><ul><li>Through a cust...
Through the Java Scripting API (JSR-232, Java >=6) </li></ul></ul>
Learning: Java Scripting API ScriptEngineManager  theScriptEngineManager  = new  ScriptEngineManager (); ScriptEngine  the...
Architecture: How to be prepared? <ul><li>In order to be able to adapt to different requierements, we will use an architec...
The overall goal is to have an architecture where the different parts communicate through clearly defined interfaces, so t...
Using an “opinionated” artechitecture with tight integration brings other advantages and drawbacks. </li></ul>
But don't go overboard with it or...
…  it will look like this:
Architecture: Tiers <ul><li>This is the web development SoC architecture we have used
Upcoming SlideShare
Loading in...5
×

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

402

Published on

The talk I gave at JavaOne Brazil 2010.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
402
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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

  1. 1. Dynamic and rich web application using the good ol' JVM
  2. 2. Introduction <ul><li>Web applications turned the development world upside down. </li><ul><li>Ever changing requirements
  3. 3. Heterogeneous equipment (client OS, browsers, application servers, server OS)
  4. 4. Heterogeneous teams (programming, designing, SEO, accesibility, usability...)
  5. 5. Development in “web time”
  6. 6. “Peter Pan” technology </li></ul><li>And then we have to choose... </li></ul>
  7. 8. Introduction II <ul><li>What technology? </li><ul><li>How to choose?
  8. 9. Which ones to try?
  9. 10. What is important? </li><ul><li>Adoption?
  10. 11. Compatibility?
  11. 12. Background? </li></ul><li>Is there any “ magic bullet ”? </li></ul><li>That makes our team look like this... </li></ul>
  12. 14. Introduction III <ul><li>How can we improve the situation: </li><ul><li>Learn the various choices you can make so you can decide between them
  13. 15. Adapt your architecture to the web development world. </li></ul><li>So, we are here to: </li><ul><li>Showcase some technologies that can be used in the Java plattform.
  14. 16. Demonstrate that an architecture can be adaptable. </li></ul><li>The end goal is that the choice looks like... </li></ul>
  15. 18. Learning: why the JVM? <ul><li>Java is/was popular for a reason. Among other things </li><ul><li>Very good virtual machine
  16. 19. Tons of libraries, utilities, frameworks, API... </li></ul><li>So, should we start from scratch? </li><ul><li>Sometimes not possible (100% one-step migration)
  17. 20. Small steps help you move from a safe location to a closer safe location. </li></ul></ul>
  18. 21. Learning: how? <ul><li>The JVM is a bytecode interpreter/dynamic compiler so... </li><ul><li>Generate compatible bytecode from the new language. (ex. Scala)
  19. 22. Implement in bytecode an interpreter for the new language. (ex. BeanShell)
  20. 23. Combine both solutions. (ex. Groovy) </li></ul><li>The “interpreted” languages can be accessed </li><ul><li>Through a custom API
  21. 24. Through the Java Scripting API (JSR-232, Java >=6) </li></ul></ul>
  22. 25. 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 );
  23. 26. Architecture: How to be prepared? <ul><li>In order to be able to adapt to different requierements, we will use an architecture built around the Separation of Concerns (SoC) pattern.
  24. 27. 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.
  25. 28. Using an “opinionated” artechitecture with tight integration brings other advantages and drawbacks. </li></ul>
  26. 29. But don't go overboard with it or...
  27. 30. … it will look like this:
  28. 31. Architecture: Tiers <ul><li>This is the web development SoC architecture we have used
  29. 32. Where we have separated these main Concerns: </li><ul><li>User interface
  30. 33. Presentation logic
  31. 34. Controller
  32. 35. Application/business logic
  33. 36. Persistence </li></ul></ul>
  34. 37. Architecture: Showcase application <ul><li>A simple CRUD application on one table(Items).
  35. 38. Every “concern” is implemented with different technologies: </li><ul><li>To test if they really can be used independently.
  36. 39. To find out some of the benefits and drawbacks of each alternative.
  37. 40. To do some mythbusting! </li></ul></ul>
  38. 41. Showcase: Implementations <ul><li>Persistence </li><ul><li>Oracle, HSQLDB </li></ul><li>Business logic </li><ul><li>JDBC, Hibernate, JPA, Ibatis, Groovy (x2) , JRuby, JavaScript (x2) , Jython, Scala, Pnuts, PHP, PL/SQL </li></ul><li>Controller </li><ul><li>WebLEAF </li></ul><li>Presentation logic </li><ul><li>JSP, FreeMarker, XSLT, Groovlets </li></ul><li>User interface </li><ul><li>HTML, RIA: JavaScript (ExtJS, GWT), Flex, Java (Applet, JWS) </li></ul><li>Comunications </li><ul><li>JSON, XML/HTTP, Web Services </li></ul></ul>
  39. 42. 951 Possibilities!! (495 if we exclude the DB)
  40. 43. Application & business Logic
  41. 44. App. Logic: Java/JDBC
  42. 45. App. Logic: Groovy
  43. 46. App. Logic: Jython
  44. 47. App. Logic: Scala
  45. 48. User Interface
  46. 49. UI: HTML
  47. 50. UI: JavaScript RIA
  48. 51. UI: Flex RIA
  49. 52. UI: Java Applet RIA
  50. 53. UI: PDF
  51. 54. Etc... (demo) http://localhost:8080/ http://www.greeneyed.org/test/
  52. 55. Conclusions <ul><li>The JVM is not only Java and you don't have to abandon completely the Java platform.
  53. 56. There are many different languages with different styles that are more or less useful depending on your needs.
  54. 57. Learning different approaches to face all the different challenges is the way to be prepared.
  55. 58. 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.
  56. 59. Implementing such an experiment is quite an experience and acts as a vaccine against language bigotry.
  57. 60. Next question is... is any of this really useful in real life? </li><ul><li>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.
  58. 61. We have also used it to modify and “spice up” some UIs with some AJAX/JavaScript widgets. </li></ul></ul>
  59. 62. Thank you for your attention Questions?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×