Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Software Architecture Journey

Software Architecture Journey

A journey through architecture

Alexandru Simonescu

July 04, 2017
Tweet

More Decks by Alexandru Simonescu

Other Decks in Programming

Transcript

  1. Why we want a architecture? • Unified code style •

    Unified code structure • Stable platform • Fast development • Tell me yours!! Milanuncios Dev Team
  2. What • Goals ◦ Software architecture goals ◦ Stakeholders goals

    • Clean architecture • Hexagonal • Architecture layers and DDD
  3. Architecture goals • Independent of frameworks • Testable • Independent

    of UI • Independent of database • Independent of any external agency Robert C. Martin (Uncle Bob)
  4. Some product goals • Scalable • New features • Fast

    bug fixing • Maybe support pivot Alexandru Simonescu
  5. Software architecture evolution Lasagna-Oriented Architecture (aka Layered Monolith) Spaghetti-Oriented Architecture

    (aka Copy & Paste) Ravioli-Oriented Architecture (aka Microservices) What’s next?
  6. Software architecture evolution Lasagna-Oriented Architecture (aka Layered Monolith) Spaghetti-Oriented Architecture

    (aka Copy & Paste) Ravioli-Oriented Architecture (aka Microservices) Pizza-Oriented Architecture?
  7. “ “Allow and application to equally be driven by users,

    programs or automated tests, and to be developed and tested in isolation from its eventual runtime devices and databases. Alistair Cockburn
  8. Clean architecture principles • Independent of frameworks • Testable •

    Independent of UI • Independent of database • Independent of any external agency
  9. Clean architecture Application Frameworks and Drivers Interface Adapters Application Business

    Rules Enterprise Business Rules Entities Use Cases Presenters, Controllers, Gateways Web, Frameworks, DB, Devices, UI Entities Use Cases Controllers Presenters Gateways External UI DB Devices Fram ew ork
  10. Clean architecture Application Frameworks and Drivers Interface Adapters Application Business

    Rules Enterprise Business Rules Entities Use Cases Presenters, Controllers, Gateways Web, Frameworks, DB, Devices, UI Entities Use Cases Controllers Presenters Gateways External UI DB Devices Fram ew ork Core
  11. Clean architecture Application Frameworks and Drivers Interface Adapters Application Business

    Rules Enterprise Business Rules Entities Use Cases Presenters, Controllers, Gateways Web, Frameworks, DB, Devices, UI Entities Use Cases Controllers Presenters Gateways External UI DB Devices Fram ew ork Core Onion Architecture
  12. “ It’s a way of thinking and a set of

    priorities, aimed at accelerating software projects that have to deal with complicated domains. Eric Evans - Domain Driven Design
  13. Domain Every software program relates to some activity or interest

    of its user. That subject area to which the user applies the program is the domain of the software. Eric Evans, “Domain Driven Design”
  14. Model A model is a simplification. It is an interpretation

    of reality that abstracts the aspects relevant to solving problem at hand and ignores extraneous detail. Eric Evans, “Domain Driven Design”
  15. Ubiquitous Language It’s a shared jargon between domain experts and

    developers, based on domain model. Eric Evans, “Domain Driven Design”
  16. Entity An object with clear identity and a lifecycle with

    state transitions that we care about.
  17. Value Object An object that contains attributes but has no

    conceptual identity. They should be treated as immutable.
  18. Value Object A small simple object, like money or a

    date range, whose equality isn’t based on identity. Martin Fowler
  19. Repository • Acts as if it were an in-memory data

    store • In tests, can use a in-memory repository • ORM is not a Repository • Like a collection but with complex querying
  20. Aggregate A DDD aggregate is a cluster of domain objects

    that can be treated as a single unit. Martin Fowler
  21. “ You should create layers AFTER you created substantial amount

    of code which you grouped together for sake of communication and to clarify code.
  22. Layers vs Tiers Presentation Layer Business Layer Data Access Layer

    Crosscutting Layer Core Core DB DB Front Front
  23. Layers Presentation Layer Application Layer Data Access Layer Crosscutting Layer

    Domain Layer Database API Persistence Infrastructure
  24. Domain Layer The domain layer is the heart of the

    software, and this is where the interesting stuff happens.
  25. “ The application layer is responsible for driving the workflow

    of the application, matching the use cases at hand.
  26. Application Layer • Defines jobs or actions that domain can

    do • Coordinates lower layers • Contains what the system should do, to satisfy a use case
  27. “ Consists of everything that exists independently of our application:

    external libraries, databases, application server, messaging backend, etc.
  28. Application interaction Presentation Application Invoke actions Actions issued from Presentation

    are delegated to the application through commands. Normally maps to a use case.
  29. Domain Service If a service makes appropriate debits and credits

    for an account, that capability belongs to domain layer, becoming a domain service.
  30. Application Service If the banking application can convert and export

    transactions into a spreadsheet, that export is an application service.
  31. Infrastructural Service A bank might have an application that sends

    an e-mail. The interface that encapsulates the email system is a infrastructure service.
  32. ◉ The clean architecture - 8th Light ◉ Hexagonal architecture

    - Alistair Cockburn ◉ Hexagonal architecture - Fideloper ◉ Hexagonal architecture - AcademyForUs (Spanish) ◉ Do you like Spaghetti or Lasagna ◉ Clean Architecture with DDD layering ◉ DDD with Symfony 2 ◉ DDD Cargo Tracker ◉ Hexagonal architecture for Java Applications Bibliography Knowledge will set you free.