The document discusses the principles and advantages of hexagonal (also known as ports and adapters) architecture in Magento projects. It promotes decoupling the core domain logic from infrastructure dependencies to improve testability. The core focuses only on the domain while adapters implement interfaces to interact with external systems. This allows framework-agnostic testing of the core and integration tests of adapters. Implementing hexagonal architecture can help create complex, long-lasting, and multi-platform code by separating concerns between the core and infrastructure.
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Meet Magento IT 2021 - Principles & Advantages of Hexagonal Architecture on Magento
1. Principles & Advantages
of Hexagonal Architecture
on Magento
June 10/11 2021 Virtual Conference
Alessandro Ronchi
COO Bitbull
2. Principles & Advantages of Hexagonal Architecture on Magento
Testing is hard
it is even harder on Magento
3. Principles & Advantages of Hexagonal Architecture on Magento
There must be a way
to simplify testing
4. Principles & Advantages of Hexagonal Architecture on Magento
to the rescue
Hexagonal architecture
5. Principles & Advantages of Hexagonal Architecture on Magento
Decoupling
Focus on the domain
Focus on testability
Advantages
6. Principles & Advantages of Hexagonal Architecture on Magento
Team mentor at Bitbull
Passionate about Software Design
Magento Master & Maintainer
About me
@aleron75
7. Principles & Advantages of Hexagonal Architecture on Magento
a different way of layering components
Hexagonal architecture
8. Principles & Advantages of Hexagonal Architecture on Magento
Decoupling
Core vs Infrastructure
39. USE-CASE TESTS
UNIT TESTS
Registration
✔ The customer can register an unregistered card
✔ The customer can’t register already registered card
✔ The customer can’t register more than one card
✔ The customer can delete a registered card
OK (4 tests)
41. USE-CASE TESTS
UNIT TESTS
Card Number
✔ It accepts ten digits
✔ It accepts all zeroes
✔ It doesn’t accept an empty string
✔ It doesn’t accept less than ten digits
✔ It doesn’t accept more than ten digits
✔ It doesn’t accept invalid chars
OK (6 tests)
46. Card Controller
✔ It calls Application service getCardByCustomer()
✔ It calls Application service registerCard()
✔ It calls Application service deleteCardByCustomer()
OK (3 tests)
INCOMING TESTS
OUTGOING TESTS
48. Card Repository
✔ It can save a card and load it by its number
✔ It can save a card and load it by its customer
✔ It can delete a card by its customer
OK (3 tests)
INCOMING TESTS
OUTGOING TESTS