SlideShare una empresa de Scribd logo
1 de 55
A new world with
                      CDI
                  An essay around some of the design changes
                         encouraged by CDI + Seam 3




Monday, May 16, 2011
Who am I ?
           •      Software developer at R&D
                  department at Softplan in
                  Brazil

           •      Seam 3 Contributor

           •      Hobbyist game programmer

           •      CIA spy (it’s a secret, don’t
                  tell anyone)




Monday, May 16, 2011
Agenda




Monday, May 16, 2011
Agenda
           •      Contextualization




Monday, May 16, 2011
Agenda
           •      Contextualization

           •      A quickly introduction to CDI




Monday, May 16, 2011
Agenda
           •      Contextualization

           •      A quickly introduction to CDI

           •      A real quickly introduction on Seam 3




Monday, May 16, 2011
Agenda
           •      Contextualization

           •      A quickly introduction to CDI

           •      A real quickly introduction on Seam 3

           •      Design simplicity with CDI




Monday, May 16, 2011
Contextualization




Monday, May 16, 2011
A little of web application history




Monday, May 16, 2011
The rise of Java

           •      CGI

           •      Servlet

           •      Servlet + JSP

           •      Templating, tag libraries

           •      The era of frameworks




Monday, May 16, 2011
Struts, Hibernate, Spring

           •      It was almost impossible to develop an application
                  with pure J2EE

           •      Different frameworks to approach different
                  application development needs

                 •     Data abstractions

                 •     IoC

                 •     Flow control



Monday, May 16, 2011
JEE 5

           •      JPA

           •      EJB3

           •      JSF1.2

           •      Annotations

           •      ...




Monday, May 16, 2011
Seam



              •        The Glue between
                       JSF and EJB

              •        Context management and DI




Monday, May 16, 2011
The Real story
           •      A king tired of lazyInitializationExceptions




Monday, May 16, 2011
Have you seen similar method
                          names?

          •     getCustomerWithAddress()

          •     getCustomerWithFoo()

          •     getCustomerWithFooAndBar()




Monday, May 16, 2011
JEE6

           • CDI
           • JSF2
           • JPA2
           • EJB3.1
           • ...


Monday, May 16, 2011
CDI main goals

           •      The Standard glue between
                  JSF and EJB

           •      Injectable beans with
                  Managed lifecycle

           •      loose coupling

           •      TypeSafe

           •      AOP and Events



Monday, May 16, 2011
“CDI simplifies and
                  sanitizes the API for DI
                         and AOP”


Monday, May 16, 2011
“CDI simplifies and
                  sanitizes the API for DI
                         and AOP”
                                 Rick Hightower




Monday, May 16, 2011
“CDI rulez!”



Monday, May 16, 2011
“CDI rulez!”
                                 me




Monday, May 16, 2011
“Designing with CDI is a road to be
                       discovered, specially when we consider
                             the event handling feature”




Monday, May 16, 2011
“Designing with CDI is a road to be
                       discovered, specially when we consider
                             the event handling feature”
                                                 me too




Monday, May 16, 2011
And seam?
                what is seam now after it externalized the CDI?




Monday, May 16, 2011
Seam’s mission is to provide a fully-
                  integrated development platform for
                building rich, standards-based internet
                 applications tailored for traditional and
                            cloud development




Monday, May 16, 2011
Now we can begin



Monday, May 16, 2011
Monday, May 16, 2011
Pragmatics approach



Monday, May 16, 2011
ECB Pattern
                       • Entity - Control - Boundary



                           EJB       CDI Bean      JPA



Monday, May 16, 2011
CEC Pattern
                 • CDI - EJB - CDI



                            EJB      CDI Bean   JPA



Monday, May 16, 2011
CEC Pattern
                 • CDI - EJB - CDI



                            EJB      CDI Bean   JPA



Monday, May 16, 2011
CEC Pattern
                 • CDI - EJB - CDI



             CDI bean       EJB      CDI Bean   JPA



Monday, May 16, 2011
CEC Pattern
                 • CDI - EJB - CDI

               Presenter



             CDI bean       EJB      CDI Bean   JPA



Monday, May 16, 2011
Simplicity



Monday, May 16, 2011
Goals

                   • Clean design
                   • Less coding, less bugs
                   • Higher productivity
                   • Easier test automation

Monday, May 16, 2011
Common design
Monday, May 16, 2011
javaee 5
Monday, May 16, 2011
javaee 6
Monday, May 16, 2011
Easy boy! the world
                            won’t end
Monday, May 16, 2011
Keeps the served list and
                                   provides it to the view through
                                                  EL
                       Renders a list                         Returns a list




Monday, May 16, 2011
Renders a list   Returns a list




Monday, May 16, 2011
And what about the actions?
Monday, May 16, 2011
Problems:

                   • Messages to the view
                   • Flow control



Monday, May 16, 2011
Messages to UI
                   • Proposed solution : Seam MessagesAPI




Monday, May 16, 2011
Flow control
          • Success and Error: the typical case
           • Validation can be done before the service
                       with Bean Validations
                • In case of exceptions it could be handled
                       by a decoupled class (Seam Catch   )




Monday, May 16, 2011
Complex cases: JSF Nav. Rules




Monday, May 16, 2011
xml??




Monday, May 16, 2011
xml navigation pros
                   • More flexible than implicity navigation
                   • IMO, returning a string as outcome is bad
                   • Clean solution to totally abstract a flow
                       controller
                   • It is tool friendly
                   • ...

Monday, May 16, 2011
Let the structure do its work




                               JSF2 complete Reference, page 12

              • JSF Complete
Monday, May 16, 2011
Monday, May 16, 2011
what about presentation
                       logic?


Monday, May 16, 2011
Model View Presenter




Monday, May 16, 2011
Be careful!



           •      take a closer look at your case

           •      choose to simplify whenever is
                  possible.




Monday, May 16, 2011
Basic references

                   • http://seamframework.org/
                   • http://www.jcp.org/en/jsr/detail?id=299
                   • http://www.adam-bien.com/


Monday, May 16, 2011
Thank you!
            •     Contact:
                  José Rodolfo Freitas
                  joserodolfo.freitas@gmail.com

            •     Supported by:
                  Softplan/Poligraph
                  http://talentos.softplan.com.br

            •     Follow on Twitter:
                  @joserodolfo_f

            •     Blog
                  techblog.joserodolfo.com


Monday, May 16, 2011

Más contenido relacionado

Similar a A new world with cdi en

Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...Brian Huff
 
Being Curious for a Living (revised)
Being Curious  for a Living (revised)Being Curious  for a Living (revised)
Being Curious for a Living (revised)Lauren Bacon
 
开放式类库的构建
开放式类库的构建开放式类库的构建
开放式类库的构建lifesinger
 
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011Guillaume Laforge
 
Kin Global Kellogg 2011 Chicago
Kin Global Kellogg 2011 ChicagoKin Global Kellogg 2011 Chicago
Kin Global Kellogg 2011 ChicagoCarlos Dominguez
 
JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forwardeug3n_cojocaru
 
Devopsdays Goteborg 2011 - State of the Union
Devopsdays Goteborg 2011 - State of the UnionDevopsdays Goteborg 2011 - State of the Union
Devopsdays Goteborg 2011 - State of the UnionJohn Willis
 
Managing Projects on a Mac
Managing Projects on a MacManaging Projects on a Mac
Managing Projects on a MacProjectWizards
 
Infusion for the birds
Infusion for the birdsInfusion for the birds
Infusion for the birdscolinbdclark
 
10 Web Development Concepts a Designer Should Know
10 Web Development Concepts a Designer Should Know10 Web Development Concepts a Designer Should Know
10 Web Development Concepts a Designer Should KnowRachel Andrew
 
Java EE and Google App Engine
Java EE and Google App EngineJava EE and Google App Engine
Java EE and Google App EngineArun Gupta
 
Javascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSJavascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSSylvain Zimmer
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackabilityPuppet
 
20110903 candycane
20110903 candycane20110903 candycane
20110903 candycaneYusuke Ando
 
Scale like an ant, distribute the workload - DPC, Amsterdam, 2011
Scale like an ant, distribute the workload - DPC, Amsterdam,  2011Scale like an ant, distribute the workload - DPC, Amsterdam,  2011
Scale like an ant, distribute the workload - DPC, Amsterdam, 2011Helgi Þormar Þorbjörnsson
 

Similar a A new world with cdi en (20)

Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
 
Being Curious for a Living (revised)
Being Curious  for a Living (revised)Being Curious  for a Living (revised)
Being Curious for a Living (revised)
 
开放式类库的构建
开放式类库的构建开放式类库的构建
开放式类库的构建
 
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
 
Kin Global Kellogg 2011 Chicago
Kin Global Kellogg 2011 ChicagoKin Global Kellogg 2011 Chicago
Kin Global Kellogg 2011 Chicago
 
Geolinkeddata 07042011 1
Geolinkeddata 07042011 1Geolinkeddata 07042011 1
Geolinkeddata 07042011 1
 
GeoLinkedData
GeoLinkedDataGeoLinkedData
GeoLinkedData
 
JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forward
 
The state of structure, 2011
The state of structure, 2011The state of structure, 2011
The state of structure, 2011
 
Devopsdays Goteborg 2011 - State of the Union
Devopsdays Goteborg 2011 - State of the UnionDevopsdays Goteborg 2011 - State of the Union
Devopsdays Goteborg 2011 - State of the Union
 
Managing Projects on a Mac
Managing Projects on a MacManaging Projects on a Mac
Managing Projects on a Mac
 
Infusion for the birds
Infusion for the birdsInfusion for the birds
Infusion for the birds
 
10 Web Development Concepts a Designer Should Know
10 Web Development Concepts a Designer Should Know10 Web Development Concepts a Designer Should Know
10 Web Development Concepts a Designer Should Know
 
Java EE and Google App Engine
Java EE and Google App EngineJava EE and Google App Engine
Java EE and Google App Engine
 
Javascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSJavascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJS
 
Beyond Page Objects
Beyond Page ObjectsBeyond Page Objects
Beyond Page Objects
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackability
 
Web Operations Career
Web Operations CareerWeb Operations Career
Web Operations Career
 
20110903 candycane
20110903 candycane20110903 candycane
20110903 candycane
 
Scale like an ant, distribute the workload - DPC, Amsterdam, 2011
Scale like an ant, distribute the workload - DPC, Amsterdam,  2011Scale like an ant, distribute the workload - DPC, Amsterdam,  2011
Scale like an ant, distribute the workload - DPC, Amsterdam, 2011
 

Último

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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 REVIEWERMadyBayot
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
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 FMESafe Software
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
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...DianaGray10
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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 challengesrafiqahmad00786416
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
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...apidays
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
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 2024Victor Rentea
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
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
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

A new world with cdi en

  • 1. A new world with CDI An essay around some of the design changes encouraged by CDI + Seam 3 Monday, May 16, 2011
  • 2. Who am I ? • Software developer at R&D department at Softplan in Brazil • Seam 3 Contributor • Hobbyist game programmer • CIA spy (it’s a secret, don’t tell anyone) Monday, May 16, 2011
  • 4. Agenda • Contextualization Monday, May 16, 2011
  • 5. Agenda • Contextualization • A quickly introduction to CDI Monday, May 16, 2011
  • 6. Agenda • Contextualization • A quickly introduction to CDI • A real quickly introduction on Seam 3 Monday, May 16, 2011
  • 7. Agenda • Contextualization • A quickly introduction to CDI • A real quickly introduction on Seam 3 • Design simplicity with CDI Monday, May 16, 2011
  • 9. A little of web application history Monday, May 16, 2011
  • 10. The rise of Java • CGI • Servlet • Servlet + JSP • Templating, tag libraries • The era of frameworks Monday, May 16, 2011
  • 11. Struts, Hibernate, Spring • It was almost impossible to develop an application with pure J2EE • Different frameworks to approach different application development needs • Data abstractions • IoC • Flow control Monday, May 16, 2011
  • 12. JEE 5 • JPA • EJB3 • JSF1.2 • Annotations • ... Monday, May 16, 2011
  • 13. Seam • The Glue between JSF and EJB • Context management and DI Monday, May 16, 2011
  • 14. The Real story • A king tired of lazyInitializationExceptions Monday, May 16, 2011
  • 15. Have you seen similar method names? • getCustomerWithAddress() • getCustomerWithFoo() • getCustomerWithFooAndBar() Monday, May 16, 2011
  • 16. JEE6 • CDI • JSF2 • JPA2 • EJB3.1 • ... Monday, May 16, 2011
  • 17. CDI main goals • The Standard glue between JSF and EJB • Injectable beans with Managed lifecycle • loose coupling • TypeSafe • AOP and Events Monday, May 16, 2011
  • 18. “CDI simplifies and sanitizes the API for DI and AOP” Monday, May 16, 2011
  • 19. “CDI simplifies and sanitizes the API for DI and AOP” Rick Hightower Monday, May 16, 2011
  • 21. “CDI rulez!” me Monday, May 16, 2011
  • 22. “Designing with CDI is a road to be discovered, specially when we consider the event handling feature” Monday, May 16, 2011
  • 23. “Designing with CDI is a road to be discovered, specially when we consider the event handling feature” me too Monday, May 16, 2011
  • 24. And seam? what is seam now after it externalized the CDI? Monday, May 16, 2011
  • 25. Seam’s mission is to provide a fully- integrated development platform for building rich, standards-based internet applications tailored for traditional and cloud development Monday, May 16, 2011
  • 26. Now we can begin Monday, May 16, 2011
  • 29. ECB Pattern • Entity - Control - Boundary EJB CDI Bean JPA Monday, May 16, 2011
  • 30. CEC Pattern • CDI - EJB - CDI EJB CDI Bean JPA Monday, May 16, 2011
  • 31. CEC Pattern • CDI - EJB - CDI EJB CDI Bean JPA Monday, May 16, 2011
  • 32. CEC Pattern • CDI - EJB - CDI CDI bean EJB CDI Bean JPA Monday, May 16, 2011
  • 33. CEC Pattern • CDI - EJB - CDI Presenter CDI bean EJB CDI Bean JPA Monday, May 16, 2011
  • 35. Goals • Clean design • Less coding, less bugs • Higher productivity • Easier test automation Monday, May 16, 2011
  • 39. Easy boy! the world won’t end Monday, May 16, 2011
  • 40. Keeps the served list and provides it to the view through EL Renders a list Returns a list Monday, May 16, 2011
  • 41. Renders a list Returns a list Monday, May 16, 2011
  • 42. And what about the actions? Monday, May 16, 2011
  • 43. Problems: • Messages to the view • Flow control Monday, May 16, 2011
  • 44. Messages to UI • Proposed solution : Seam MessagesAPI Monday, May 16, 2011
  • 45. Flow control • Success and Error: the typical case • Validation can be done before the service with Bean Validations • In case of exceptions it could be handled by a decoupled class (Seam Catch ) Monday, May 16, 2011
  • 46. Complex cases: JSF Nav. Rules Monday, May 16, 2011
  • 48. xml navigation pros • More flexible than implicity navigation • IMO, returning a string as outcome is bad • Clean solution to totally abstract a flow controller • It is tool friendly • ... Monday, May 16, 2011
  • 49. Let the structure do its work JSF2 complete Reference, page 12 • JSF Complete Monday, May 16, 2011
  • 51. what about presentation logic? Monday, May 16, 2011
  • 53. Be careful! • take a closer look at your case • choose to simplify whenever is possible. Monday, May 16, 2011
  • 54. Basic references • http://seamframework.org/ • http://www.jcp.org/en/jsr/detail?id=299 • http://www.adam-bien.com/ Monday, May 16, 2011
  • 55. Thank you! • Contact: José Rodolfo Freitas joserodolfo.freitas@gmail.com • Supported by: Softplan/Poligraph http://talentos.softplan.com.br • Follow on Twitter: @joserodolfo_f • Blog techblog.joserodolfo.com Monday, May 16, 2011