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

Tackling complex domains: strategies and patterns

Tackling complex domains: strategies and patterns

Most web applications are dealing with non-trivial tasks, such as calculating prices and billing items, booking reservations, etc. Each of these topics is a complex domain: there are many requirements, some business rules, and many interactions to handle. If the software project is not organized, architectured, complexity goes up and the project quickly derails.

This talk has a look at how we move from requirements to software architecture, and then to code. We will discuss strategies to discover a domain, tools to model it and share it with the team, and finally patterns to express it in code.
Amongst those, there are Domain-Driven Design and Enterprise Architecture. Though they can't be fully applied every time, I believe some of their techniques can be useful every day. And every developer could benefit from tools to get a better understanding of what they are coding and how to express their intention in their code.

Romaric Drigon

August 04, 2020
Tweet

More Decks by Romaric Drigon

Other Decks in Programming

Transcript

  1. How to code those? ☑ Easily! - what to code?

    specifica/on? ☑ Bug free - tests? edge cases? ☑ Easy to maintain - long life)me
  2. This project in numbers • 8 developers !""""""" • 6

    months • we wrote 59 769 lines of PHP (tests not included) • using Symfony framework • 584 classes
  3. What is a domain? A sphere of knowledge, influence, or

    ac6vity. The subject area to which the user applies a program is the domain of the so?ware. — Eric Evans In my project, it was legal case management
  4. We want a useful model of that domain “With Domain-Driven

    Design, it’s a model of the business domain that ma9ers most.” — Vaugh Vernon, Implemen1ng Domain-Driven Design So we need to understand the domain, to model it and to code this model in our project
  5. How to discover a domain? Get access and discuss with

    business people, for whom you are making the so6ware (users): They are stakeholders It doesn't work well in closed organiza3ons (silos); with remote agencies; or when doing "communica3on-through-specifica3on"
  6. Event Storming “A method to discover business processes” Picture from

    h-ps:/ /medium.com/techlabs-emag/what-is-event- storming-ed1a0e519fad
  7. “A common, shared, vocabulary, where words have a specific and

    well-defined meaning in your applica3on”
  8. Think of Bounded Contexts as microservices But it does not

    have to be separate apps: bundles, packages, modules, or folders...
  9. Our code should contain a Domain Model, a set of

    classes describing the business ≠ infrastructure code, which is dealing with technical details, such as database access, e-mail sending...
  10. In example • inside Drive Bounded Context • En##es are

    objects containing both business logic and persisted data • we are using an ORM to handle database read/write • non-persisted objects in Model folder Project was using Symfony framework and Doctrine ORM
  11. Some business rules are not easy to code. • many

    branches (complexity) • hard to follow • process spans over several days • etc. Then we need help more specifically with how to structure our code
  12. Events: dispatcher pa,ern Our code throw events, listeners react to

    those • allows to decouple • avoids duplica0on • listeners tend to be small classes • easier to test
  13. It worked out pre,y well The part of the project

    I contributed to was successful: • Major deadlines were met • Team could integrate new developers easily • First version was released, and development of new features con;nues
  14. Feedback over strategies 1. Meet business people: great, but not

    always easy 2. Use a common vocabulary • Ubiquitous Language 3. Split big apps into smaller pieces • Bounded Contexts 4. Code a rich Domain Model • business classes are the crown jewels of your app
  15. Feedback over pa-erns • + makes code easier to understand

    • + allows to decouple sub-units: • productivity++ • facilitates team work (less Git conflicts) • + usually easier to test • - requires more explana;on at the beginning