SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Mundo novo com
                       CDI
                Um ensaio sobre as mudanças encorajadas pelo
                               CDI + Seam 3




Monday, May 16, 2011
Quem sou eu ?
           •      Analista no PD da Softplan

           •      Seam 3 Contributor

           •      Hobbyist game programmer

           •      Espião da CIA




Monday, May 16, 2011
Agenda




Monday, May 16, 2011
Agenda
           •      Contextualização




Monday, May 16, 2011
Agenda
           •      Contextualização

           •      Uma rápida introdução ao CDI




Monday, May 16, 2011
Agenda
           •      Contextualização

           •      Uma rápida introdução ao CDI

           •      Uma rapidíssima introdução ao Seam 3




Monday, May 16, 2011
Agenda
           •      Contextualização

           •      Uma rápida introdução ao CDI

           •      Uma rapidíssima introdução ao Seam 3

           •      simplicidade com CDI




Monday, May 16, 2011
Contextualização




Monday, May 16, 2011
Aplicações Web na história




Monday, May 16, 2011
Ascensão do Java

           •      CGI

           •      Servlet

           •      Servlet + JSP

           •      Templating, tag libraries

           •      A era dos frameworks




Monday, May 16, 2011
Struts, Hibernate, Spring

           •      Praticamente impossível desenvolver uma aplicação
                  em J2EE puro

           •      Frameworks diferentes para abstrair necessidades
                  das aplicações

                 •     Abstração de dados

                 •     Inversão de Controle

                 •     Controle de fluxo



Monday, May 16, 2011
JEE 5

           •      JPA

           •      EJB3

           •      JSF1.2

           •      Annotations

           •      ...




Monday, May 16, 2011
Seam



              •        A cola necessária para juntar
                       JSF e EJB

              •        Contextos e Injeção de dependência




Monday, May 16, 2011
A verdadeira história
           •      Um king cansado de lazyInitializationExceptions




Monday, May 16, 2011
Quem nunca viu bizarrices assim?


          •     getCustomerWithAddress()

          •     getCustomerWithFoo()

          •     getCustomerWithFooAndBar()




Monday, May 16, 2011
JEE6

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


Monday, May 16, 2011
Principais objetivos do CDI

           •      Cola Standard entre JSF e EJB

           •      Beans injetáveis e com ciclo
                  de vida gerenciado

           •      Baixo acoplamento

           •      TypeSafe

           •      AOP e Eventos




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 é foda!”



Monday, May 16, 2011
“CDI é foda!”
                                  eu




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”
                                                eu também




Monday, May 16, 2011
E o seam?
                          como ficou nessa história?




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
Chegamos aonde eu
                            queria


Monday, May 16, 2011
Monday, May 16, 2011
abordagens mais
                         pragmáticas


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
Simplicidade



Monday, May 16, 2011
Objetivos

                   • Arquitetura limpa
                   • Menos código, menos bugs
                   • Maior produtividade
                   • Mais facilidades com testes

Monday, May 16, 2011
arquitetura comum
Monday, May 16, 2011
javaee 5
Monday, May 16, 2011
javaee 6
Monday, May 16, 2011
Calma!
Monday, May 16, 2011
Monday, May 16, 2011
Monday, May 16, 2011
E para as actions?
Monday, May 16, 2011
Problemas:

                   • Mensagens para a interface
                   • Controle de fluxo



Monday, May 16, 2011
Mensagens para UI
                  • O uso de MessagesAPI do Seam




Monday, May 16, 2011
Controle de fluxo
          • Caso Típico de sucesso e erro
           • A validação pode ser feita antes de
                       chegar no serviço (Bean Validations)
                • Em caso de exceções elas podem ser
                       capturadas desacopladamente e fazer
                       redirecionamentos. (Seam Catch )



Monday, May 16, 2011
JSF Navigation Rules




Monday, May 16, 2011
xml??




Monday, May 16, 2011
controlador: Faces Servlet




                               JSF2 complete Reference, pagina 12

              • JSF Complete
Monday, May 16, 2011
Monday, May 16, 2011
e lógica de apresentação?



Monday, May 16, 2011
Model View Presenter




Monday, May 16, 2011
Cuidado!



           •      Analise sempre seu caso

           •      Simplifique sempre que possível.




Monday, May 16, 2011
Referências

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


Monday, May 16, 2011
Obrigado!
            •     Contato:
                  José Rodolfo Freitas
                  joserodolfo.freitas@gmail.com

            •     Apoio:
                  Softplan/Poligraph
                  http://talentos.softplan.com.br

            •     Follow on Twitter:
                  @joserodolfo_f

            •     Blog
                  techblog.joserodolfo.com


Monday, May 16, 2011

Weitere ähnliche Inhalte

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Mundo novo com cdi

  • 1. Mundo novo com CDI Um ensaio sobre as mudanças encorajadas pelo CDI + Seam 3 Monday, May 16, 2011
  • 2. Quem sou eu ? • Analista no PD da Softplan • Seam 3 Contributor • Hobbyist game programmer • Espião da CIA Monday, May 16, 2011
  • 4. Agenda • Contextualização Monday, May 16, 2011
  • 5. Agenda • Contextualização • Uma rápida introdução ao CDI Monday, May 16, 2011
  • 6. Agenda • Contextualização • Uma rápida introdução ao CDI • Uma rapidíssima introdução ao Seam 3 Monday, May 16, 2011
  • 7. Agenda • Contextualização • Uma rápida introdução ao CDI • Uma rapidíssima introdução ao Seam 3 • simplicidade com CDI Monday, May 16, 2011
  • 9. Aplicações Web na história Monday, May 16, 2011
  • 10. Ascensão do Java • CGI • Servlet • Servlet + JSP • Templating, tag libraries • A era dos frameworks Monday, May 16, 2011
  • 11. Struts, Hibernate, Spring • Praticamente impossível desenvolver uma aplicação em J2EE puro • Frameworks diferentes para abstrair necessidades das aplicações • Abstração de dados • Inversão de Controle • Controle de fluxo Monday, May 16, 2011
  • 12. JEE 5 • JPA • EJB3 • JSF1.2 • Annotations • ... Monday, May 16, 2011
  • 13. Seam • A cola necessária para juntar JSF e EJB • Contextos e Injeção de dependência Monday, May 16, 2011
  • 14. A verdadeira história • Um king cansado de lazyInitializationExceptions Monday, May 16, 2011
  • 15. Quem nunca viu bizarrices assim? • getCustomerWithAddress() • getCustomerWithFoo() • getCustomerWithFooAndBar() Monday, May 16, 2011
  • 16. JEE6 • CDI • JSF2 • JPA2 • EJB3.1 • ... Monday, May 16, 2011
  • 17. Principais objetivos do CDI • Cola Standard entre JSF e EJB • Beans injetáveis e com ciclo de vida gerenciado • Baixo acoplamento • TypeSafe • AOP e Eventos 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 é foda!” eu 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” eu também Monday, May 16, 2011
  • 24. E o seam? como ficou nessa história? 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. Chegamos aonde eu queria Monday, May 16, 2011
  • 28. abordagens mais pragmáticas 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. Objetivos • Arquitetura limpa • Menos código, menos bugs • Maior produtividade • Mais facilidades com testes Monday, May 16, 2011
  • 42. E para as actions? Monday, May 16, 2011
  • 43. Problemas: • Mensagens para a interface • Controle de fluxo Monday, May 16, 2011
  • 44. Mensagens para UI • O uso de MessagesAPI do Seam Monday, May 16, 2011
  • 45. Controle de fluxo • Caso Típico de sucesso e erro • A validação pode ser feita antes de chegar no serviço (Bean Validations) • Em caso de exceções elas podem ser capturadas desacopladamente e fazer redirecionamentos. (Seam Catch ) Monday, May 16, 2011
  • 48. controlador: Faces Servlet JSF2 complete Reference, pagina 12 • JSF Complete Monday, May 16, 2011
  • 50. e lógica de apresentação? Monday, May 16, 2011
  • 52. Cuidado! • Analise sempre seu caso • Simplifique sempre que possível. Monday, May 16, 2011
  • 53. Referências • http://seamframework.org/ • http://www.jcp.org/en/jsr/detail?id=299 • http://www.adam-bien.com/ Monday, May 16, 2011
  • 54. Obrigado! • Contato: José Rodolfo Freitas joserodolfo.freitas@gmail.com • Apoio: Softplan/Poligraph http://talentos.softplan.com.br • Follow on Twitter: @joserodolfo_f • Blog techblog.joserodolfo.com Monday, May 16, 2011