Enterprise Software Engineering with C# and .NET: Architecture, Design Patterns, and AI-Enabled Systems · HIT

Week 9   Part IV · Domain Logic and Security

Domain-Driven Design and Business Logic

Instructor lesson plan: lecture (2 h) and practice (2 h).

Learning objectives

Tools this week

domain modeluse-case servicesevent sketchesworkflow examples

🎓Lecture · 2 hours

0:00-0:2020 minUbiquitous languageNaming concepts from the business domain, not from UI screens or database tables.
0:20-0:4525 minAggregates and invariantsConsistency boundaries and transaction decisions.
0:45-1:0520 minDomain services and application servicesDistinguishing business calculations from orchestration.
1:05-1:1510 minBreak
1:15-1:4025 minDomain eventsExpressing something meaningful that happened, without inventing distributed complexity.
1:40-2:0020 minWorkflow examplesReviewing business behavior through use cases.
Common misconception to confront.

Students often think: all rules belong in services.
Set it straight: invariants that protect an entity or aggregate should live with that model when possible.

Check for understanding
What is an aggregate boundary?
A consistency boundary that groups entities and value objects changed together under invariants.
When use a domain service?
When a business operation does not naturally belong to one entity or value object.
Key takeaways.

📚Reading & resources

💻Practice · 2 hours

0:00-0:2525 minLanguage reviewTeams rename vague concepts and write a glossary.
0:25-1:0035 minAggregate designIdentify one aggregate and encode its invariants.
1:00-1:1010 minBreak
1:10-1:4535 minWorkflow examplesAdd examples for successful and failed business workflows.
1:45-2:0015 minProject-integration briefDocument aggregate boundaries and business rules.

Project integration (this week)

PreviousWeek 8: Clean ArchitectureNextWeek 10: Security and Robust API Design