mooc-notes

Notes from online courses

View on GitHub

Clean Architecture - Patterns, Practices and Principles - Pluralsight course by Matthew Renze

Module 1 - Course overview

Course overview


Module 2 - Introduction

Purpose of the course

Focus

Audience

What is Clean Code?

What is Software Architecture?

Levels of Architectural Abstraction

This course will be covering mostly layers and components and bit of sub-systems when covering microservices

Messy vs. Clear Architecture - Spaghetti vs. Lasagna

What is Bad Architecture?

What is Good Architecture?

What is Clean Architecture? Architecture that is designed for the inhabitants of the architecture (users, developers building and maintaining the system)… not for the architect (put aside his or her own desires and wishes and design what’s best for the inhabitants of the system)… or the machine (optimise first for the inhabitants and only optimise for the machine when necessary, i.e., we want to avoid premature optimisation). Clean architecture is a philosophy of architectural essentialism. It’s about focusing on what’s truly essential to the software’s architecture instead of the implementation detail. 

Why invest in Clean Architecture?

Decisions, decisions, decisions…


Module 3 - Domain-centric Architecture

Overview 
Domain-centric Architecture

DBCA - architecture revolved around the database. Lately, there has been shift towards making the Domain the center and considering the db as just an implementation detail

“The first concern of the architect is to make sure that the house is usable, it is not to ensure that the house is made of brick.” - Uncle Bob

What is essential vs. detail? 

E.g. while building a house:

Similarly, we need to look at what is essential for the inhabitants of the architecture

Domain-centric architectures

Hexagonal Architecture

Hexagonal archiecture

Onion Architecture

Onion Architecture

No inner layer knows about the outer layer. 

The Clean Architecture

The Clean Architecture

All 3 architectures have roughly the same benefits. Essentially, they put the domain model at the center, wrap it in an application layer which embeds the use cases, adapts the application to implementation details and all dependencies should point inwards towards the domain. 

Pros and Cons

Pros

Cons


Module 4 - Application Layer

Overview
What are Layers?

Boundaries and Vertical partitions of an application designed to 

Essentially, layers are how we slice the application into manageable units of complexity

Classic Three-layer Architecture

Suitable for basic CRUD applications. 

Modern Four-layer Architecture
Application layer 
Layer dependencies

Dependency inversion - abstractions should not depend on details, rather, details should depend on abstractions. Hence the arrow from infrastructure to application and persistence to application instead of the other way around. 

Inversion of control - that is, the dependencies oppose the flow of control in our application, which provides several benefits like

Sometimes we may need to add an additional dependency from the persistence to the domain when using an Object Relational Mapper. This is necessary for the ORM to map the domain entities into tables in the database since the persistence layer needs to know about the domain entities. But using an ORM is optional but saves a tremendous amount of time. 

Why use an Application Layer?

Pros

Cons



Module 5 - Commands and Queries

Overview
Command-Query Separation
CQRS Architectures
Pros and Cons
Demo

video


Module 6 - Functional Organization

Overview
Screaming Architecture
Pros and Cons
Demo

video


Module 7 - Microservices

Overview
Components
Bounded Context
Microservices
Pros and Cons
Demo

video


Module 8 - Testable Architecture

Overview
The Current State of Testing
Test-Driven Development
Types of tests
Test Automation Pyramid
Pros and Cons
Demo

video


Module 9 - Evolving the Architecture

Overview
Evolving the Architecture
Where to go next