SlideShare a Scribd company logo
1 of 69
Pegando carona no
Command Bus
@brunodasneves
brunonm@gmail.com
Bruno Neves
Pegando carona no Command Bus
Alto acoplamento
Pegando carona no Command Bus
Baixa coesão
Pegando carona no Command Bus
Reusabilidade? (risos)
Pegando carona no Command Bus
Service Layer!
Pegando carona no Command Bus
Fat model, skinny controller
Pegando carona no Command Bus
Fachada para as operações que o
sistema realiza
Pegando carona no Command Bus
Diminui o acoplamento com o
framework
Pegando carona no Command Bus
Separa o negócio das camadas de
infraestrutura
Pegando carona no Command Bus
Pode ser executado por um comando
agendado na crontab, por um
listener, por uma requisição http e
etc.
Pegando carona no Command Bus
Excesso de atividades que devem ser
executadas antes e depois do
objetivo principal
Pegando carona no Command Bus
Repetição das mesmas rotinas na
maioria dos serviços (log, transação,
commit, rollback)
Pegando carona no Command Bus
Doloroso para testar
Pegando carona no Command Bus
Single Responsability
Pegando carona no Command Bus
Commands!
Pegando carona no Command Bus
Mensagem
Pegando carona no Command Bus
Representa a intenção do usuário
Pegando carona no Command Bus
Nome no imperativo
Purchase Album
Pegando carona no Command Bus
Data Transfer Object
Pegando carona no Command Bus
Não possui comportamento
Pegando carona no Command Bus
Beleza! Mas quem vai executar?
Pegando carona no Command Bus
Command Handler!
Pegando carona no Command Bus
Executa o command e apenas isso
Pegando carona no Command Bus
1:1
Um Command possui apenas um Handler
Um Handler possui apenas um Command
Pegando carona no Command Bus
Vários problemas permanecem...
Pegando carona no Command Bus
Command Bus!
Pegando carona no Command Bus
Possibilita a execução de rotinas
ANTES e APÓS a execução do
Command propriamente dito
Pegando carona no Command Bus
Middlewares!
Pegando carona no Command Bus
Validator Middleware?
Pegando carona no Command Bus
Transaction Middleware?
Pegando carona no Command Bus
Logging Middleware?
Tacticianhttp://tactician.thephpleague.com/
> composer require league/tactician
No Framework
Pegando carona no Command Bus
Menos dependências!
Pegando carona no Command Bus
Testabilidade
Pegando carona no Command Bus
Altamente coeso
Pegando carona no Command Bus
Agnóstico de framework
Pegando carona no Command Bus
Domínio isolado de outras camadas
Pegando carona no Command Bus
Fluxo padronizado.
Excelente para equipes!
Pegando carona no Command Bus
Interface única: handle()
Pegando carona no Command Bus
CQS
Command Query Separation
Pegando carona no Command Bus
Ferramentas similares
• BROADWAY
• LiteCQRS
• SimpleBUS
Pegando carona no Command Bus
Assuntos relacionados
DDD CQRS
Domain Events
CQS Event Sourcing
Hexagonal Architecture
Pegando carona no Command Bus
Referências
http://tactician.thephpleague.com/
http://php-and-symfony.matthiasnoback.nl/2015/01/a-wave-of-command-buses/
https://www.reddit.com/r/PHP/comments/29a6qz/what_am_i_missing_with_this_whole_command_bus/
http://whitewashing.de/2012/08/18/oop_business_applications__command_query_responsibility_seggregation.html
http://www.sitepoint.com/command-buses-demystified-a-look-at-the-tactician-package/
http://pt.slideshare.net/rosstuck/command-bus-to-awesome-town
http://pt.slideshare.net/rosstuck/models-and-service-layers-hemoglobin-and-hobgoblins
http://shawnmc.cool/command-bus
Pegando carona no Command Bus
Imagens
https://safetycompass.files.wordpress.com/2013/08/school-bus.jpg
http://martinfowler.com/eaaCatalog/ServiceLayerSketch.gif
http://allchristiannews.com/wp-content/uploads/2013/05/victory.jpg
http://imguol.com/c/entretenimento/d7/2016/02/03/mc-bin-laden-comeca-2016-tranquilo-e-favoravel-faco-hang-loose-p
http://reactionface.net/reactionface/images/original/119.jpg?new=1
http://staples.vteximg.com.br/arquivos/ids/200696-1000-1000/TCOTI0754.jpg
http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/01/1453218734middleware-pipeline.png
http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/01/1453218740command-pattern.png
http://www.quickmeme.com/img/6b/6b79a252a3471c9566ecb540f4013dbcaba6361d4ae17cf2209acd183
dac1268.jpg
Pegando carona no Command Bus
Obrigado!

More Related Content

Similar to Pegando carona no Command Bus

xACMEConfigurationsBostonSiteRouter1.txtBostonSiteRouter1#sho.docx
xACMEConfigurationsBostonSiteRouter1.txtBostonSiteRouter1#sho.docxxACMEConfigurationsBostonSiteRouter1.txtBostonSiteRouter1#sho.docx
xACMEConfigurationsBostonSiteRouter1.txtBostonSiteRouter1#sho.docx
ericbrooks84875
 

Similar to Pegando carona no Command Bus (10)

Think your software is fault-tolerant? Prove it!
Think your software is fault-tolerant? Prove it!Think your software is fault-tolerant? Prove it!
Think your software is fault-tolerant? Prove it!
 
Benchmarking OTM and Java - Is Your Platform Limiting Performance
Benchmarking OTM and Java - Is Your Platform Limiting PerformanceBenchmarking OTM and Java - Is Your Platform Limiting Performance
Benchmarking OTM and Java - Is Your Platform Limiting Performance
 
xACMEConfigurationsBostonSiteRouter1.txtBostonSiteRouter1#sho.docx
xACMEConfigurationsBostonSiteRouter1.txtBostonSiteRouter1#sho.docxxACMEConfigurationsBostonSiteRouter1.txtBostonSiteRouter1#sho.docx
xACMEConfigurationsBostonSiteRouter1.txtBostonSiteRouter1#sho.docx
 
Serverless Workflows on AWS - A Journey from SWF to Step Functions
Serverless Workflows on AWS - A Journey from SWF to Step FunctionsServerless Workflows on AWS - A Journey from SWF to Step Functions
Serverless Workflows on AWS - A Journey from SWF to Step Functions
 
Mod11
Mod11Mod11
Mod11
 
TDD in the Web with Python and Django
TDD in the Web with Python and DjangoTDD in the Web with Python and Django
TDD in the Web with Python and Django
 
Building CLIs with Ruby
Building CLIs with RubyBuilding CLIs with Ruby
Building CLIs with Ruby
 
Terminus, the Pantheon command-line interface
Terminus, the Pantheon command-line interfaceTerminus, the Pantheon command-line interface
Terminus, the Pantheon command-line interface
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansible
 
10 Command Line quan trọng để giao tiếp với Cisco IOs
10 Command Line quan trọng để giao tiếp với Cisco IOs10 Command Line quan trọng để giao tiếp với Cisco IOs
10 Command Line quan trọng để giao tiếp với Cisco IOs
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Pegando carona no Command Bus

  • 1. Pegando carona no Command Bus @brunodasneves brunonm@gmail.com Bruno Neves
  • 2.
  • 3. Pegando carona no Command Bus Alto acoplamento
  • 4. Pegando carona no Command Bus Baixa coesão
  • 5. Pegando carona no Command Bus Reusabilidade? (risos)
  • 6. Pegando carona no Command Bus Service Layer!
  • 7.
  • 8. Pegando carona no Command Bus Fat model, skinny controller
  • 9.
  • 10.
  • 11.
  • 12. Pegando carona no Command Bus Fachada para as operações que o sistema realiza
  • 13. Pegando carona no Command Bus Diminui o acoplamento com o framework
  • 14. Pegando carona no Command Bus Separa o negócio das camadas de infraestrutura
  • 15. Pegando carona no Command Bus Pode ser executado por um comando agendado na crontab, por um listener, por uma requisição http e etc.
  • 16.
  • 17.
  • 18. Pegando carona no Command Bus Excesso de atividades que devem ser executadas antes e depois do objetivo principal
  • 19. Pegando carona no Command Bus Repetição das mesmas rotinas na maioria dos serviços (log, transação, commit, rollback)
  • 20. Pegando carona no Command Bus Doloroso para testar
  • 21. Pegando carona no Command Bus Single Responsability
  • 22.
  • 23. Pegando carona no Command Bus Commands!
  • 24.
  • 25. Pegando carona no Command Bus Mensagem
  • 26. Pegando carona no Command Bus Representa a intenção do usuário
  • 27. Pegando carona no Command Bus Nome no imperativo Purchase Album
  • 28. Pegando carona no Command Bus Data Transfer Object
  • 29. Pegando carona no Command Bus Não possui comportamento
  • 30.
  • 31. Pegando carona no Command Bus Beleza! Mas quem vai executar?
  • 32. Pegando carona no Command Bus Command Handler!
  • 33.
  • 34. Pegando carona no Command Bus Executa o command e apenas isso
  • 35. Pegando carona no Command Bus 1:1 Um Command possui apenas um Handler Um Handler possui apenas um Command
  • 36.
  • 37. Pegando carona no Command Bus Vários problemas permanecem...
  • 38. Pegando carona no Command Bus Command Bus!
  • 39.
  • 40.
  • 41.
  • 42. Pegando carona no Command Bus Possibilita a execução de rotinas ANTES e APÓS a execução do Command propriamente dito
  • 43.
  • 44. Pegando carona no Command Bus Middlewares!
  • 45.
  • 46. Pegando carona no Command Bus Validator Middleware?
  • 47. Pegando carona no Command Bus Transaction Middleware?
  • 48. Pegando carona no Command Bus Logging Middleware?
  • 50. > composer require league/tactician
  • 52.
  • 53.
  • 54.
  • 55. Pegando carona no Command Bus Menos dependências!
  • 56. Pegando carona no Command Bus Testabilidade
  • 57. Pegando carona no Command Bus Altamente coeso
  • 58. Pegando carona no Command Bus Agnóstico de framework
  • 59. Pegando carona no Command Bus Domínio isolado de outras camadas
  • 60. Pegando carona no Command Bus Fluxo padronizado. Excelente para equipes!
  • 61. Pegando carona no Command Bus Interface única: handle()
  • 62. Pegando carona no Command Bus CQS Command Query Separation
  • 63.
  • 64. Pegando carona no Command Bus Ferramentas similares • BROADWAY • LiteCQRS • SimpleBUS
  • 65. Pegando carona no Command Bus Assuntos relacionados DDD CQRS Domain Events CQS Event Sourcing Hexagonal Architecture
  • 66.
  • 67. Pegando carona no Command Bus Referências http://tactician.thephpleague.com/ http://php-and-symfony.matthiasnoback.nl/2015/01/a-wave-of-command-buses/ https://www.reddit.com/r/PHP/comments/29a6qz/what_am_i_missing_with_this_whole_command_bus/ http://whitewashing.de/2012/08/18/oop_business_applications__command_query_responsibility_seggregation.html http://www.sitepoint.com/command-buses-demystified-a-look-at-the-tactician-package/ http://pt.slideshare.net/rosstuck/command-bus-to-awesome-town http://pt.slideshare.net/rosstuck/models-and-service-layers-hemoglobin-and-hobgoblins http://shawnmc.cool/command-bus
  • 68. Pegando carona no Command Bus Imagens https://safetycompass.files.wordpress.com/2013/08/school-bus.jpg http://martinfowler.com/eaaCatalog/ServiceLayerSketch.gif http://allchristiannews.com/wp-content/uploads/2013/05/victory.jpg http://imguol.com/c/entretenimento/d7/2016/02/03/mc-bin-laden-comeca-2016-tranquilo-e-favoravel-faco-hang-loose-p http://reactionface.net/reactionface/images/original/119.jpg?new=1 http://staples.vteximg.com.br/arquivos/ids/200696-1000-1000/TCOTI0754.jpg http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/01/1453218734middleware-pipeline.png http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/01/1453218740command-pattern.png http://www.quickmeme.com/img/6b/6b79a252a3471c9566ecb540f4013dbcaba6361d4ae17cf2209acd183 dac1268.jpg
  • 69. Pegando carona no Command Bus Obrigado!