SlideShare a Scribd company logo
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

More Related Content

Similar to 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
 
GeoLinkedData
GeoLinkedDataGeoLinkedData
GeoLinkedData
Alexander De Leon
 
JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forwardeug3n_cojocaru
 
The state of structure, 2011
The state of structure, 2011The state of structure, 2011
The state of structure, 2011
Scriptorium Publishing
 
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 Mac
ProjectWizards
 
Infusion for the birds
Infusion for the birdsInfusion for the birds
Infusion for the birds
colinbdclark
 
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
Rachel Andrew
 
Java EE and Google App Engine
Java EE and Google App EngineJava EE and Google App Engine
Java EE and Google App Engine
Arun 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 NodeJS
Sylvain Zimmer
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackability
Puppet
 
Web Operations Career
Web Operations CareerWeb Operations Career
Web Operations Career
Theo Schlossnagle
 
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, 2011
Helgi Þormar Þorbjörnsson
 

Similar to 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
GeoLinkedDataGeoLinkedData
GeoLinkedData
 
Geolinkeddata 07042011 1
Geolinkeddata 07042011 1Geolinkeddata 07042011 1
Geolinkeddata 07042011 1
 
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
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 

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