Day 1: Advanced Web Application Architecture
Starting out with a traditionally structured web application we recognize that it's tied to a particular web framework and database vendor, and that it's hard to test domain logic in isolation. This is true not only for the sandbox application but for many real-world applications as well. It's a danger for the long-term maintainability of such an application, and it will eventually slow down the development of the project to the point where the team begs for a complete rewrite. That's not the direction we choose in this training. Instead of a big rewrite, we refactor the existing code in small steps over multiple iterations, until we have a decoupled core surrounded by a layer of infrastructure code. We then separate the classes into three layers and distinguish Ports and Adapters (from Hexagonal Architecture).
Part 1: Decoupling code by extraction using the Application service, Command, Entity, and Repository pattern.
Part 2: Reorganizing the application into layers: Domain, Application, and Infrastructure.
Day 2: Test-first Development for Decoupled Applications
Test suites usually suffer from the following test smells:
- Tests take a long time to run
- When they fail it's hard to find out why
- They verify domain rules through the UI
- They fail randomly
Once you know how to decouple your application's domain logic from surrounding infrastructure, a whole new testing strategy comes within reach. With a decoupled core, leveraging design patterns from day 1 (e.g. application services, entities, domain events), you will be able to execute all the business logic in isolation: without a database, without external services, even without a user interface. You will be able to achieve all of the following:
- The tests are very fast
- They give detailed feedback
- Domain rules are verified close to the domain model
- They are deterministic
Workshop Structure
You can chose to follow either the first day, or both days.
- Advanced Web Application Architecture
- Advanced Web Application Architecture + Test-first Development for Decoupled Applications
There are seperate tickets for these options.
During the workshop we'll work with a simple web application written in PHP. You'll need at least some experience with the language and an MVC framework like Symfony or Laravel.