Introduction to Domain Driven Design
Getting the software right is a hard thing to do. This is because business
and developers do not always talk the same language. Domain Driven Design
is all about getting the language right between them.
- What is Domain Driven Design?
- Advantages of using Domain Driven Design
- When is Domain Driven Design a bad option?
Architecting Modern Web Applications
So what is a modern web application? One that uses Angular and TypeScript?
With the speed that modern web application development evolves, there is
the chance that your web site uses 'old' technology by the time it is
done. But sound architecture never goes stale. As a wise man once said:
'If you think good architecture is expensive, try bad architecture'.
"Clean" Architecture: put the business and application model at the
- Understanding the Core, Infrastructure and Presentation layer
- Testing everything with Clean Architecture
LAB: Build the application structure using Clean Architecture principles
Unit testing in .NET
Every developer wants clean code that works. So how does one get to
maintainable and working code? And moreover: keep it working.
What every developer wants: Quality code that works; and keeps on
Finding bugs: not just in code. - Or how NASA lost a 125.000.000$ Mars
- What is unit testing? And what is a good unit test?
Understanding the difference between a unit test and an integration test
- Test Driven Development - Should you be doing it?
- Role-playing: Marge, Homer and Bart
The Triple-A of unit testing - and what has cooking to do with this?
Unit testing with Visual Studio with xUnit
When Unit Testing, you will have to decide on frameworks. There are
several ones out there, which one do I need? Visual Studio comes with a
built in framework called MSTest, but you also have others, such as the
popular xUnit. In this module, we will discuss pros and cons of these
frameworks, and go into some best practices. How do I know if I have
tested enough? With code coverage you can see which paths in your code you
have tested, and easily discover untested conditional logic.
- Unit Testing best practices with XUnit
- Facts and Theories
- Using the Test Explorer Window
- Live unit testing with Visual Studio
- Running tests in parallel, or not
- Measuring and improving Code Coverage
- Replacing dependencies using Fakes, Stubs and Mocks
- Building Stubs and Mocks using NSubstitute
When constructing the domain model, there are several approaches. Tactical
Design provides a set of technical resources and patterns that are used in
the construction of the domain model. The goal is to enrich your domain
model by applying these standards correctly. When done correctly, it will
reflect your business model with more clarity, and allow for better
communication and design.
- What is tactical design?
- Entities, Services, Aggregates, etc...
- Applying Tactical Design to a real world business case
Tactical Design - Entities and Value Objects
DDD distinguishes between Entities and Value Objects. How do you implement
- Differentiating between Entities and Value Objects
- Designing Entities their Identity
- Designing immutable Value Objects
- Implementing Value Objects Equality efficiently
- C# 9 records
- LAB: Adding the Entities and Value Objects to the game store
Tactical Design - Domain Services and Modules
Some behavior cannot be easily mapped to an existing Entity or Value
Object. In this case we put this behavior into a Domain Service. And how
do we group our business objects into modules?
- Providing domain specific operations with Domain Services
- Domain, Infrastructure and Application Services
- Segregating concepts using Modules
- LAB: Adding some Domain Services to the game store
One of the core pillars of DDD is Strategic Modeling. Strategic modelling
helps you at defining the Bounded Contexts, the Ubiquitous Language and
- Anti-Pattern: Big Ball of Mud
- The linguistic delimitation that are Bounded Contexts
- Identifying the terms and concepts with the Ubiquitous Language
- Relating Bounded Contexts with Context Maps
Tactical Design - Life Cycle, Aggregates, Factories and Repositories
Grouping your entities in Aggregates can make development easier, and help
to avoid the "Death by a Thousand Dots" anti-pattern. Entities have a life
cycle, and how do your create complex hierarchies of entities?
- Clustering Entities and Value Objects with Aggregates
- Anti-Pattern: Death by a Thousand Dots
- Abstracting the creation of business objects with Factories
- Data storage by using Repositories
- Abstracting queries using Specifications
- LAB: Implementing the life-cycle of your aggregates
Modeling your database with EF Core
Mapping in EF Core uses conventions, attributes, or Fluent API. You will
see how to use these to model your database in EF Core and apply the
changes with Code-first Migrations.
- Methods of configuration
- Creating and applying migrations
- Table and column mapping
- Modeling properties
- Mapping Value generated properties
- Handling Concurrent updates
- Modeling relationships
- Mapping inheritance
- LAB: Mapping your entities to the database with EF Core
Advanced EF: Mapping DDD to EF Core.
Domain Driven Design is a great way to start designing your applications.
Entity Framework Core is a great framework to access and manipulate your
data, stored in databases. Now, can we fit Domain Driven Design concepts
into Entity Framework Core? Yes, we can!
- DDD and Persistance Ignorance
- Implementing Value Objects with Owned Properties
- Using Shadow Properties to Avoid 'Leaky Abstractions'
- Building Repository and Specification classes
- Testing your Specifications
- Entity Validation
- LAB: Optimizing the mapping of your entities
Tactical Design - Domain Events
When building larger applications you want to keep Low Coupling and High
Cohesion. So how do you implement changes that need to be handled by
- What are Domain Events?
- Publishing significant domain changes with Domain Events
- Using MediatR with Domain Events
- LAB: Adding Domain Events to the game store application
Unit Testing ASP.NET Core Web Applications
When creating modern web applications with ASP.NET Core MVC, it's not that
straightforward to unit test the Controllers and Views. How does one
validate whether the ActionResult returned by the Controller action is the
one you wanted, as well as whether the View is correct. How do we replace
dependencies during testing with MVC? How do we perform end-to-end
- Challenges when unit testing MVC applications
- Writing unit tests for your MVC controllers
- Unit testing ApiControllers
- Testing data access, such as Repositories and Specifactions
- Using the ASP.NET Core testing framework
- End-to-end testing
- LAB: Implementing integration and end-to-end tests
When architecting and developing applications, there are several
approaches that could be considered.
Domain-Driven Design (DDD) is one of them. The idea of
domain-driven design is to let the software originate from the so-called
domain, and keeping the business experts and developers on the same
When creating business applications, there is often a need for a data
access layer to some database. This is where
Entity Framework Core (EF) jumps in. In fact, domain-driven
design and EF Core can go perfectly hand in hand. This course will discuss
the concepts of domain-driven design and how EF Core can help you at
implementing these concepts.
In this course, participants will learn about modern architecture and will
get a hands-on approach to building a web site using C#, DDD, EF Core and