Masterclass

Clean Pragmatic Architecture

About

This training is a pragmatic review of the most common architectural decisions of a backend system, including Layered Architecture, agnostic Domain, feature slicing, decoupled subdomains (Modulith), data mappers, and validation. For a deeper understanding, most concepts are demonstrated in Java code, uncovering a series of implementation tricks that you can immediately apply to your project. The last section overviews practical strategies that you can use to gradually decouple a monolithic system into independent subdomains.

The lack of a clear structure can slow us down and put the project in danger, but over-engineering can also generate remarkable waste of time, money, and brainpower. To help you find the amount of “just-enough design”, this training adopts a pragmatic point of view and then introduces techniques to gradually evolve the design to match the growing functional complexity.

Course contents

  • Fundamentals
    • Coupling and Cohesion
    • SOLID principles, Beck’s Rules of Simple Design
    • Program to Abstractions
  • Data structures – 1 hour
    • Domain Model: rich, deep, and valid
    • Data Transfer Objects (DTOs): goal, contract- vs code-first, pragmatic tricks
    • Data Mappers and the Fallacy of Auto-Mappers (eg. MapStruct, ModelMapper…)
    • Adapter Pattern as an Anti-Corruption Layer
    • Dependency Inversion Principle
  • Organizing Logic in Layers – 1 hour
    • Layered Architecture
    • Introducing Application Services as Facades
    • Keeping Domain Services cohesive
    • Evolutionary Architecture – hands-on
  • Pragmatic Onion Architecture – 1 hour
    • Onion Architecture Rules (preview)
    • Comparison with Hexagonal Architecture (aka Ports-and-Adapters)
    • Separating Domain from Persistence – cost/benefit debate
    • Use-case optimized Queries
    • Sources of Overengineering in Concentric Architectures
    • Enforcing architectural boundaries
  • Vertical Slicing Architecture (aka slice by UseCase)
    • Group by axis of change
    • Command/Query separation
    • Pros/Cons, Pitfalls
  • Modular Monolith (Modulith) – 2 hours
    • Finding Module (Service) Boundaries – heuristics and pitfalls
    • Cut Entity links between modules
    • Delineate a module ‘Internal API’
    • Remove cyclic dependencies between modules – 6 strategies
    • Introduce events for more decoupling (?)
    • Sacrifice Consistency – per-module transactions
  • Wrap-up: Quiz & Debates + main take-aways

 

By the end of the live course, you’ll understand:

  • Dependency Inversion Principle, and why it’s essential in architectures
  • How to simplify logic via Separation by Layers of Abstraction
  • The principles underlying the Onion-, Hexagonal-, and Clean- Architectures
  • The main challenges of breaking down a codebase in vertical slices

And you’ll be able to:

  • Simplify your core logic by protecting it against API models
  • Progressively extract orchestration logic from existing code in Facades
  • Compare and apply strategies to decouple a monolith in subdomains

Target audience and prerequisites

This Training is for you because…

  • You are a developer with hands-on experience in software design, that can read Java
  • You are an architect or a technical lead looking to debate key design decisions
  • You are an enthusiastic learner who wants to enter the area of software architecture

Prerequisites

To be able to browse the code sample easily on your local machine, you would need a laptop with JDK 11+, a decent IDE and access to GitHub and Maven Central.

Technical Stack used in Live-Coding Examples: Java/Spring, but the discussion will be loosely coupled to the language/framework specifics, so backend developers of all languages are welcome.

Prep work

If you want the best of this training, you can prepare in advance by:

  • READ this (very influential) article about Clean Architecture:

https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html

 

About the Trainer

Victor is a Java Champion, and Trainer writing code for over two decades. He regularly shares his passion for Refactoring, Architecture, and Unit Testing with the Bucharest Software Crafters Community that he founded, today one of the largest in the world. He gives intense conference talks that aim to educate in a live, entertaining way. On victorrentea.ro you can find past talks, training offers, video classes, and social channels.

24 March 2023