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

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
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
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
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
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Último (20)

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
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...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
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
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

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