• Save
A new world with cdi en
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

A new world with cdi en

  • 2,942 views
Uploaded on

An essay around some of the design changes encouraged by CDI + Seam 3

An essay around some of the design changes encouraged by CDI + Seam 3

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,942
On Slideshare
2,374
From Embeds
568
Number of Embeds
4

Actions

Shares
Downloads
0
Comments
0
Likes
2

Embeds 568

http://techblog.joserodolfo.com 564
http://www.slideshare.net 2
url_unknown 1
http://webcache.googleusercontent.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. A new world with CDI An essay around some of the design changes encouraged by CDI + Seam 3Monday, 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
  • 3. AgendaMonday, May 16, 2011
  • 4. Agenda • ContextualizationMonday, May 16, 2011
  • 5. Agenda • Contextualization • A quickly introduction to CDIMonday, May 16, 2011
  • 6. Agenda • Contextualization • A quickly introduction to CDI • A real quickly introduction on Seam 3Monday, May 16, 2011
  • 7. Agenda • Contextualization • A quickly introduction to CDI • A real quickly introduction on Seam 3 • Design simplicity with CDIMonday, May 16, 2011
  • 8. ContextualizationMonday, May 16, 2011
  • 9. A little of web application historyMonday, May 16, 2011
  • 10. The rise of Java • CGI • Servlet • Servlet + JSP • Templating, tag libraries • The era of frameworksMonday, 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 controlMonday, 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 DIMonday, May 16, 2011
  • 14. The Real story • A king tired of lazyInitializationExceptionsMonday, 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 EventsMonday, 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 HightowerMonday, May 16, 2011
  • 20. “CDI rulez!”Monday, May 16, 2011
  • 21. “CDI rulez!” meMonday, 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 tooMonday, 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 developmentMonday, May 16, 2011
  • 26. Now we can beginMonday, May 16, 2011
  • 27. Monday, May 16, 2011
  • 28. Pragmatics approachMonday, May 16, 2011
  • 29. ECB Pattern • Entity - Control - Boundary EJB CDI Bean JPAMonday, May 16, 2011
  • 30. CEC Pattern • CDI - EJB - CDI EJB CDI Bean JPAMonday, May 16, 2011
  • 31. CEC Pattern • CDI - EJB - CDI EJB CDI Bean JPAMonday, May 16, 2011
  • 32. CEC Pattern • CDI - EJB - CDI CDI bean EJB CDI Bean JPAMonday, May 16, 2011
  • 33. CEC Pattern • CDI - EJB - CDI Presenter CDI bean EJB CDI Bean JPAMonday, May 16, 2011
  • 34. SimplicityMonday, May 16, 2011
  • 35. Goals • Clean design • Less coding, less bugs • Higher productivity • Easier test automationMonday, May 16, 2011
  • 36. Common designMonday, May 16, 2011
  • 37. javaee 5Monday, May 16, 2011
  • 38. javaee 6Monday, May 16, 2011
  • 39. Easy boy! the world won’t endMonday, May 16, 2011
  • 40. Keeps the served list and provides it to the view through EL Renders a list Returns a listMonday, May 16, 2011
  • 41. Renders a list Returns a listMonday, May 16, 2011
  • 42. And what about the actions?Monday, May 16, 2011
  • 43. Problems: • Messages to the view • Flow controlMonday, May 16, 2011
  • 44. Messages to UI • Proposed solution : Seam MessagesAPIMonday, 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. RulesMonday, May 16, 2011
  • 47. xml??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 CompleteMonday, May 16, 2011
  • 50. Monday, May 16, 2011
  • 51. what about presentation logic?Monday, May 16, 2011
  • 52. Model View PresenterMonday, 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.comMonday, May 16, 2011