Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Framework Independent Architectures

106 views

Published on

Presentation at Coolblue Behind the Scenes on using Ports and Adapters to achieve an architecture that is independent of frameworks and infrastructure

Published in: Software
  • Be the first to comment

  • Be the first to like this

Framework Independent Architectures

  1. 1. Framework Independent Architectures. Nathan Johnstone – n.johnstone@coolblue.nl
  2. 2. Focus
  3. 3. A Bit About Me
  4. 4. Early Software Development
  5. 5. Pigs != Pegs
  6. 6. The Starting Point
  7. 7. Joining a Team
  8. 8. Infrastructure Dependencies Web API Message Service Scheduler
  9. 9. Application Assemblies Web API Message Service Scheduler Data Access Domain Common
  10. 10. Application Dependencies Web API Message Service Scheduler Data Access Domain Common
  11. 11. Class Library Dependencies Web API Message Service Scheduler Data Access Domain Common
  12. 12. N-Tier Web API Data Access Domain
  13. 13. Isn't Something Missing?
  14. 14. Pain
  15. 15. Leakage
  16. 16. DRY - Reuse Reuse Reuse !
  17. 17. Test Coverage Unit Tests Component Tests Acceptance Tests Integration Tests
  18. 18. Implementing Integration Tests
  19. 19. Interfaces Colocated With Implementations Data Access Domain PurchaseOrderSubmitServiceIPurchaseOrderRetriever PurchaseOrderRetriever ?
  20. 20. Who Owns The Interface ?
  21. 21. Colocation Problems Data Access Domain PurchaseOrderSubmitServiceIPurchaseOrderRetriever PurchaseOrderPurchaseOrderDocument
  22. 22. Isolation Violation PurchaseOrderDocument Domain
  23. 23. Reference Direction vs Control Direction Presentation Layer Data Access Layer Business Logic Layer Reference DirectionControl Direction
  24. 24. Ports & Adapters Introduction Allow an application to equally be driven by users, programs, automated test or batch scripts, and to be developed and tested in isolation from its eventual run-time devices and databases.
  25. 25. Hexagonal Architecture
  26. 26. Inside / Outside
  27. 27. First Port - Persistence Web API Message Service Scheduler Data Access Domain Common Persistence Adapter
  28. 28. Second Port - Commands Web API Message Service Scheduler Data Access Domain Persistence Adapter Command Adapter
  29. 29. Upstream / Downstream Ports
  30. 30. Third Port - Notification Web API Message Service Scheduler Data Access Domain Persistence Adapter Command Adapter Notification Adapter
  31. 31. Clean Up Web API Message Service Scheduler Data Access Domain Persistence Adapter Command Adapter Notification Adapter
  32. 32. Domain Hexagonal - Domain Web API Message Service Scheduler Persistence Adapter Command Adapter Notification Adapter
  33. 33. Domain Hexagonal - Persistence Port Web API Message Service Scheduler Persistence Adapter Command Adapter Notification Adapter
  34. 34. Domain Hexagonal - Command Port Web API Message Service Scheduler Persistence Adapter Command Adapter Notification Adapter
  35. 35. Domain Hexagonal - Notification Port Web API Message Service Scheduler Persistence Adapter Command Adapter Notification Adapter
  36. 36. Hosts Are Types of Adapters Web Service Test Harness Command Line Daemon Windows Service Graphical UI
  37. 37. Domain Hexagonal - Host Port Web API Message Service Scheduler Persistence Adapter Command Adapter Notification Adapter Host Port
  38. 38. Advantages - Domain Testability Domain Web API Message Service Scheduler Persistence Adapter Command Adapter Notification Adapter Host Port
  39. 39. Advantages - Boundaries Web API Message Service Scheduler Domain Persistence Adapter Command Adapter Notification Adapter
  40. 40. Advantages - Alternative Adapters Domain Web API Message Service Scheduler Persistence.Adapter Command.Adapter Notification Adapter Host Port Persistence.Adapter Csv Command.Adapter File
  41. 41. Domain Notification via SMTP Web API Message Service Scheduler Persistence Adapter Command Adapter Notification Adapter Host Port
  42. 42. Takeaways ● Onion Architecture, Clean Architecture and Ports & Adapters are essentially the same thing ● Ports are just a name given to a common group of abstractions in your domain ● Adapters are a group of specific implementations of ports ● Example repository on github for .NET ● Ports & Adapters is an architectural style that will produce framework independent applications
  43. 43. ● http://alistair.cockburn.us/Hexagonal+architecture ● http://blog.ploeh.dk/2013/12/03/layers-onions-ports-adapters-its-all-the-same/ ● https://github.com/nrjohnstone/ports-adapters-examples ● https://www.linkedin.com/in/nrjohnstone ● https://nathanjohnstone.wordpress.com/ ● n.johnstone@coolblue.nl

×