architecting .net solutions for the...

34
Architecting .NET Solutions for the Enterprise Dino Esposito JetBrains dino.esposito@jetbrains.com @despos facebook.com/naa4e

Upload: others

Post on 26-Jun-2020

4 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Architecting .NET Solutions

for the Enterprise

Dino Esposito

JetBrains

[email protected]

@despos

facebook.com/naa4e

Page 2: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

WARNINGThis is NOT simply a shameless plug

but a truly helpful reference

“I will say that in a number of cases, a page

from this book erased a mass of confusion I'd

acquired from Vaughn Vernon's Implementing

Domain-Driven Design. This was written in a

much more concise, clear, practical manner

than that book.”

—(non anonymous) Amazon reviewer

Page 3: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

http://naa4e.codeplex.com

Page 4: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Line-of-business

Soft Skills

Communication

Problem solving

DevOps

Tooling

Productivity

Doc and code in sync

Numbers

Page 5: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Line-of-business

Analysis

Ubiquitous Language

Event Storming

UX-driven design

Development

CQRS

Message-based logic

Polyglot persistence

Page 6: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Conducting Domain Analysis

Page 7: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Different way of

building business

logic

Domain modeling

is the focus of

development

Organizes them

into a set of

principles

Captures known

elements of the

design process

Why Is DDD So Intriguing?

Page 8: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

DDD Key MisconceptionIt’s all about using objects and hardcode

business behavior in objects.

• Persistence?

• External services

• Cross-objects business logic?

• Business events?

Page 9: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

An all-encompassing object model describing the entire domain

The Secret Dream of Any Developer

Give me enough time

and enough specs

and I’ll build the world

for you.

Domain-driven

design patterns

Data-centric

design patterns

Complexity

Time

NOTE: Adapted from Martin Fowler’s PoEAA

Page 10: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Crunch knowledge about the domain1

Recognize subdomains2

Design a rich domain model3

Code by telling objects in the

domain model what do to4

DDD Is Still About Business Logic

Page 11: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

At Work Defining the

Ubiquitous Language

Cancel the booking

Checkout

Extend the job order

Register/Accept the invoice

Delete the booking

Submit the order

Update the job order

Create the invoice

Set state of the game Start/Pause the game

Page 12: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Event Storming

Page 13: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Developers and domain experts

together in a meeting room

Exploring a business domain starting from observable domain events

The two-pizza rule sets the right

number of invited people

Page 14: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Exploring a business domain starting from observable domain events

Necessary equipment

Page 15: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

• Use a sticky note of a given color to put events on the wall

Identify relevant domain events

• User action? Add a sticky note of a different color

• Asynchronous event? Add a sticky note of a different color

• Another event? Add another sticky of same color on top

Find what causes the event

• Add notes with markers

Look at the modeling surface as a timeline

How It Works

Note

Page 16: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Leads the meeting

Starts the meeting asking

questions

Sticks first notes on the

wall to show the way

Guides the modeling

effort

Asks question to better

understand the emerging model

Ensures ideas are represented

accurately

Keep focused and moves

ahead

Facilitator

Page 17: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Comprehensive vision of the

business domain

Bounded contexts and aggregates in

each context

Aggregate handles commands and

controls persistence

Types of users in the system

Personas who runs commands

and why

Where UX is critical

Sketches of relevant screens

Benefits

Page 18: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

UX-driven Design

Page 19: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Two distinct architect roles acting together

UX

Architect

Interviews to collect usability requirements data

and build the ideal UX for the presentation layer

Software

Architect

Interviews to collect requirements and

business information to build the domain layer

Page 20: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Responsibilities of a UX Expert

Information architecture

• UI and UX

• Interaction and visual design

Usability reviews

• Observing users live in action (even filming users)

• Listening to their feedback

Catch design/process bottlenecks soon

• Focus is data flow, NOT graphics

Page 21: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

UX-first in 3 Steps

Build up UI forms as users

love them

Define workflows from

there

Connect workflows to

existing biz logic

Sign-off

here

Page 22: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Top-down

Sign off on what users really want

• Sketches/wireframes

• In some cases, mockups

Build prototypes from requirements

• Not data models

• Do not start on billable hours until signed off

• (Waterfall like)

Page 23: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Top down

Page 24: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Presentation

Black box

Page 25: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Tools Do It Better

• Renaming

• Adjusting namespaces

• Refactoring

Page 26: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Development

Page 27: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Presentation layer

Application layer

Infrastructure layer

Canonical layered architecture

Domain layer

Presentation layer

Application layer

Infrastructure layer

CQRS

Commands Queries

Domain layer

Data

access

+

DTO

Page 28: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

DEMO

Page 29: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Context map is the diagram that provides a

comprehensive view of the system being designed

Backoffice

Core

DomainU

D

U

D

Weather

Forecasts(external)

Club

Site

U

D

ACL

Page 30: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Layered

Architecture

Model for the

Domain

Presentation

Application

Domain

Infrastructure

UX

Use-cases

Business

Persistence

Polyglot persistence

Relational

NoSQL

MemoryPersistence

Business

Patterns

TX Script

Table Module

Domain Model

CQRS

Event Sourcing

Page 31: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

Logic invariant to use-cases

• Domain model

• Domain services

Domain Layer

Not necessarilyan implementation of the

Domain Model pattern

Takes care of persistence tasks

Page 32: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

DEMOs

Page 33: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

At the end of the day …

The key lesson today is being aware of emerging new ways of doing old things.

Not because you can no longer do the same old things in the same known way, but because newer implementation may let the system evolve in a much smoother way saving you a BBM and some maintenance costs.

Page 34: Architecting .NET Solutions for the Enterprisesddconf.com/brands/sdd/library/Architecting_Solutions_For_The_Enterprise.pdfDomain-driven design patterns Data-centric design patterns

FOLLOW

Thank You!

facebook.com/naa4e

software2cents.wordpress.com

[email protected]

@despos

http://naa4e.codeplex.com/ Project MERP