Trends in modern software architecture
...and how to avoid them
Layered
Hexagonal
You end up with lots of interfaces and duplications that constantly change during development, creating a hard-to-maintain codebase
spring.threads.virtual.enabled=true
From the Spring WebFlux documentation:
We expect that, for a wide range of applications, the shift is unnecessary.
...all benefit from separate models
Maintaining separate models, along with controller classes, business logic, persistence layers etc, leads to far more complex software projects
Separate models implicitly lead to eventual consistency (stale reads)
Always consider using a plain CRUD API first
Start CRUD API, evolve a separate write API over time, keeping the CRUD API for queries
From Greg Young's blog:
CQRS is not a silver bullet
CQRS is not a top level architecture
CQRS is not new
CQRS is not shiny
CQRS will not make your jump shot any better
[...]
CQRS can open many doors.
Object Persistence
Event Sourcing
Focus on change instead of state makes building reactive systems easier
All domain objects implicitly have a history
Very complex persistence pattern
Usually implemented along with CQRS, leading to exponentially more complex software systems
When used with CQRS, the aggregates aren't allowed to answer queries
Very steep learning curve
Event-driven systems can easily be build using simple persistence patterns
When a history of domain objects is required (eg, for auditing), consider using Envers
Unless you're building a real-time stock trading system, don't do it
Do the simplest thing that could possibly work
Non-functional requirements matter!
Consider the available skill set
Mind Conways law
Highly aligned, loosely coupled
Make sure technical and business goals align