its all about the domain honey

54
WPS - Workplace Solutions GmbH //// Hans-Henny-Jahnn-Weg 29 //// 22085 HAMBURG It’s all about the domain, honey! Dr. Carola Lilienthal [email protected], @cairolali www.wps.de

Upload: carola-lilienthal

Post on 09-Jan-2017

205 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Its all about the domain honey

WPS - Workplace Solutions GmbH //// Hans-Henny-Jahnn-Weg 29 //// 22085 HAMBURG

It’s all about the domain, honey!

Dr. Carola Lilienthal

[email protected], @cairolali

www.wps.de

Page 2: Its all about the domain honey

19.04.2016 //// Seite 3WPS - Workplace Solutions GmbH

Software-

Architektur

Anforderungs-

ermittlung

Leitstand und

Interaktion

Individual-

software

Business-Software,

die Spaß macht!

WPS – Workplace Solutions GmbH

Page 3: Its all about the domain honey

19.04.2016 //// Seite 4WPS - Workplace Solutions GmbH

WIR SIND PROGRAMMIERER...

Page 4: Its all about the domain honey

19.04.2016 //// Seite 5WPS - Workplace Solutions GmbH

... UND WIR LIEBEN TECHNIK

Page 5: Its all about the domain honey

19.04.2016 //// Seite 6WPS - Workplace Solutions GmbH

SOFTWARE != SELBSTZWECK

Software ist ein Mittel zum Zweck

Kein Selbstzweck

Das Ziel ist das Ziel

Page 6: Its all about the domain honey

19.04.2016 //// Seite 7WPS - Workplace Solutions GmbH

ANWENDER

Page 7: Its all about the domain honey

19.04.2016 //// Seite 8WPS - Workplace Solutions GmbH

SOFTWARE UND DOMÄNE

Schreibe Software, die tief in der

Domäne verwurzelt ist!

Software

Domäne

Page 8: Its all about the domain honey

19.04.2016 //// Seite 9WPS - Workplace Solutions GmbH

WAS IST DIE DOMÄNE?

Domäne: Ein abgrenzbares Problemfeld, dem eine Software gewidmet ist

Software entspringt einer Domäne und steht damit in engem Zusammenhang

Es ist verlockend, zu viel Zeit mit dem technischen Code zu verbringen!

Page 9: Its all about the domain honey

19.04.2016 //// Seite 10WPS - Workplace Solutions GmbH

DOMAIN DRIVEN DESIGN ANWENDEN

Zu Beginn eines Softwareprojekts:

Fokussiere die Domäne in der die Software eingesetzt wird

Wie erschafft man Software, die zu einer Domäne passt?

Begreife Software als Reflektion

der Domäne

Lasse Kernkonzepte und

Elemente der Domäne

in die Software einfließen

Realisiere ihre

Zusammenhänge

Erstelle ein Domänenmodell

Page 10: Its all about the domain honey

19.04.2016 //// Seite 11WPS - Workplace Solutions GmbH

DAS MODELL KOMMUNIZIEREN

Das Modell kann nicht nur in unseren Köpfen bestehen

Wir müssen Wissen und Informationen verteilen

Grafisch

Schriftlich

Mündlich

Eine gemeinsame Sprache ist notwendig, um

das Modell ausdrücken zu können

Page 11: Its all about the domain honey

19.04.2016 //// Seite 12WPS - Workplace Solutions GmbH

TECHNISCHE SPRACHE

X

Class

Database

Server

Client

O/R-MappingInheritance

A

B

Method

Interface

Linux

Windows

Eclipse

Visual Studio

Page 12: Its all about the domain honey

19.04.2016 //// Seite 13WPS - Workplace Solutions GmbH

DOMÄNEN-SPRACHE

Container

Containernummer

4300

Kran

Twistlock

Konnossement

Beispiel: Hafen

Page 13: Its all about the domain honey

19.04.2016 //// Seite 14WPS - Workplace Solutions GmbH

Fach-

sprache

Techno

Babble

?

ALLGEGENWÄRTIGE FACHSPRACHE

Page 14: Its all about the domain honey

19.04.2016 //// Seite 15WPS - Workplace Solutions GmbH

Fach-

sprache

Techno

Babble

Fach-

sprache

ALLGEGENWÄRTIGE FACHSPRACHE

Page 15: Its all about the domain honey

19.04.2016 //// Seite 16WPS - Workplace Solutions GmbH

Fach-

sprache

Techno

Babble

ALLGEGENWÄRTIGE FACHSPRACHE

Page 16: Its all about the domain honey

19.04.2016 //// Seite 17WPS - Workplace Solutions GmbH

Techno

Babble

Fach-

sprache

ALLGEGENWÄRTIGE FACHSPRACHE

Page 17: Its all about the domain honey

19.04.2016 //// Seite 18WPS - Workplace Solutions GmbH

Fach-

sprache

{

Techno

Babble

}

?

ALLGEGENWÄRTIGE FACHSPRACHE

Page 18: Its all about the domain honey

19.04.2016 //// Seite 19WPS - Workplace Solutions GmbH

Fach-

sprache

{

Fach-

sprache

}

ALLGEGENWÄRTIGE FACHSPRACHE

Page 19: Its all about the domain honey

19.04.2016 //// Seite 20WPS - Workplace Solutions GmbH

ALLGEGENWÄRTIGE FACHSPRACHE

Verwende die gemeinsame Sprache in..

der Kommunikation

mündlich

schriftlich

grafisch

im Code

Im Grunde genommen überall

Deswegen nennt sich die Fachsprache allgegenwärtig.

Page 20: Its all about the domain honey

19.04.2016 //// Seite 21WPS - Workplace Solutions GmbH

SPRACHE TAUCHT NICHT EINFACH AUF

Es braucht Wochen bis Monate...

harter Arbeit

und scharfem Fokus

… um die Schlüsselkonzepte offenzulegen.

Die ersten Wörter einer allgemeinen Fachsprache kommen

üblicherweise direkt aus der Domäne

Im laufe der Entwicklung werden neue Begriffe definiert

und hinzugefügt

Page 21: Its all about the domain honey

19.04.2016 //// Seite 22WPS - Workplace Solutions GmbH

DOMÄNEN-SPRACHE

Brett

König

Figuren

Spieler

Schachuhr

Page 22: Its all about the domain honey

19.04.2016 //// Seite 23WPS - Workplace Solutions GmbH

ALLGEGENWÄRTIGE FACHSPRACHE

Brett

Figuren

Spieler

NichtmenschlicherSpieler

Page 23: Its all about the domain honey

19.04.2016 //// Seite 24WPS - Workplace Solutions GmbH

SPRACHEN SIND LEBENDIG

Experimentiere mit alternativen Ausdrucksformen

Das Modell und die Sprache entwickeln sich weiter

Überarbeite dann den Code

Benenne Klassen, Methoden, Module

Entspreche dem neuen Modell

Eine Sprache will gesprochen werden:

Beseitige Unklarheiten durch Konversation

Page 24: Its all about the domain honey

19.04.2016 //// Seite 25WPS - Workplace Solutions GmbH

Page 25: Its all about the domain honey

19.04.2016 //// Seite 26WPS - Workplace Solutions GmbH

WORKSHOPS ZU PROZESSA- UND ANFORDERUNGS-ANALYSE MIT ANWENDERN ODER DEM PO

“Georgia?” by The Library of Congress, flickr.com

• Teilnehmer aus verschiedenen Bereichen (Business, IT, Management, …)

• 1 Moderator, 1 Modellierer an der Tastatur

• “live” Modellierung mit einem Projektor direktes Feedback von allen Beteiligten

Page 26: Its all about the domain honey

19.04.2016 //// Seite 27WPS - Workplace Solutions GmbH

eGPM „Die Methode mit den Männchen“

http://www.omilab.org/web/bpm

Wer tut was

womit und

warum?

Page 27: Its all about the domain honey

19.04.2016 //// Seite 28WPS - Workplace Solutions GmbH

Glossar

• Fachsprache der Benutzer

• bereits existierende Begriffe

• rekonstruierte Begriffe

• neue Begriffsbildungen

• Wer tut was damit warum?

Page 28: Its all about the domain honey

19.04.2016 //// Seite 29WPS - Workplace Solutions GmbH

DIE OBJEKTORIENTIERTE GRUNDIDEE: FACHLICHE GEGENSTÄNDE ALS AUSGANGSPUNKT

Page 29: Its all about the domain honey

19.04.2016 //// Seite 30WPS - Workplace Solutions GmbH

DIE OBJEKTORIENTIERTE GRUNDIDEE: AUS FACHLICHEN

GEGENSTÄNDEN WERDEN KLASSEN

Die Artefakte der Fachdomäne...

... werden in ihrem Verhaltenfachlich modelliert ...

einfügen

beschriften

suchen

entnehmen

Der Kundenordner

... und softwaretechnisch in fachlichen Klassen beschrieben.

beschriften

suchen

Liste der Dokumente

Zeichenkette

Integer

Klasse Ordner

einfügen (Dokument doc)

{

assert doc!=null, „NN“);

docs.add(doc);

}entnehmen

einfügen

Page 30: Its all about the domain honey

19.04.2016 //// Seite 31WPS - Workplace Solutions GmbH

SCHNITTSTELLEN DER FACHLICHEN KLASSEN

Das Konzept der Modellierung von fachlichen Klassen:

• Wähle anwendungsfachliche Begriffe ( als Substantiv)

• Beschreibe Umgangsformen ( als Verb) und die dabei benötigten

weiteren Gegenstände.

Keine Daten

modellieren.

Ordner- Dokument entnehmen- Dokument einfügen- mit Text beschriften- Beschriftung?- Dokument suchen- Dokument auswählen- das Register aufschlagen- voll?...

Page 31: Its all about the domain honey

19.04.2016 //// Seite 32WPS - Workplace Solutions GmbH

TRENNUNG VON FACHLICHER + TECHNISCHER SOFTWARE

Application Kernel

Persistence

GUI 2

Database

Altsystem B

Altsystem AAdapter

A

Adapter

B

GUI 1

interfaces submitted to

third parties

Transformations-Software

Technische Software

Vermischte Software

Fachliche Software

Page 32: Its all about the domain honey

19.04.2016 //// Seite 33WPS - Workplace Solutions GmbH

ELEMENTE VON DOMAIN-DRIVEN-DESIGN

Services

Factories

Value Objects

Repositories

Aggregates

Entities

Infrastruktur-

Komponente"M

ikro

-Schic

htu

ng"

Fachobjekte

Unterstützen den

Lebenszyklus der

Fachobjekte

Page 33: Its all about the domain honey

19.04.2016 //// Seite 34WPS - Workplace Solutions GmbH

DIE FACHLICHEN „KERNELEMENTE“ VON DDD

Services

Value Objects

Entities

zustandslos

veränderlicher

Zustand

unveränderlicher

Zustand

"Mik

ro-S

chic

htu

ng"

Page 34: Its all about the domain honey

19.04.2016 //// Seite 35WPS - Workplace Solutions GmbH

Page 35: Its all about the domain honey

19.04.2016 //// Seite 36WPS - Workplace Solutions GmbH

ENTITIES

Sind die Kernobjekte einer

Fachdomäne.

Besitzen eine

zustandsunabhängige,

unveränderliche Identität.

Haben einen klar definierten

Lebenszyklus.

Besitzen einen (meist

veränderlichen) Zustand.

Beschreiben ihren Zustand

mithilfe von ValueObjects.

Sind praktisch immer

persistent.

Versicherungs-

nehmer• Name

• Vorname

• Straße

• PLZ

• Ort

• Versicherungs-

nummer

Beitrags-

zahler• Name

• Vorname

• IBAN

• BIC

Versicherte

Person• Name

• Vorname

• Tarif

Forderung• Geldbetrag

• Fälligkeit

• Schuldner

Bankver-

bindung• IBAN

• BIC

Person• Name

• Vorname

Page 36: Its all about the domain honey

19.04.2016 //// Seite 37WPS - Workplace Solutions GmbH

ENTITIES – BEISPIELE

Versicherungspolice

Urlaubsantrag

Baumaßnahme

Kaufvertrag

Fahrauftrag

Page 37: Its all about the domain honey

19.04.2016 //// Seite 38WPS - Workplace Solutions GmbH

VALUE OBJECTS

Symbolisieren Werte

eines bestimmten Typs

der Fachdomäne.

Symbolisieren bei

Gleichheit denselben

Wert.

Sind unveränderlich.

Können ggf. (aus

anderen ValueObjects)

berechnet werden.

Können aus anderen

ValueObjects bestehen,

aber nie aus Entitäten!

ValueObject

2,5

ValueObject

ValueObject

ValueObject

ValueObject

zwei-

einhalb

Page 38: Its all about the domain honey

19.04.2016 //// Seite 39WPS - Workplace Solutions GmbH

VALUE OBJECTS – BEISPIELE

Postleitzahl

GPS-Koordinate

IBAN

Containernummer

IATA-Code

Page 39: Its all about the domain honey

19.04.2016 //// Seite 40WPS - Workplace Solutions GmbH

ANEMIC DOMAIN MODEL

„blutarme“ fachliche Objekte

Schnittstelle ohne Aussagekraft

aus Gettern/Settern

Viele String Parameter

Eigentliche Fachlichkeit außerhalb Entities +

Value Objects in Services oder im UI

Oberhalb des Modells findet man Klassen

mit dupliziertem Code zur

Konsistenzprüfung

Konvertierung

Validierung

Viele Util, Helper und Manager Klassen

Page 40: Its all about the domain honey

19.04.2016 //// Seite 41WPS - Workplace Solutions GmbH

ANEMIC FEHLENDE ROBUSTHEIT

Designschulden

Unklarer, schwer verständlicher

Entwurf

Verteilte Fachlichkeit

Copy&Paste-Programmierung

Teure Wartung

Duplizierter Code

Viele Refactorings

Schlechte Testbarkeit

Page 41: Its all about the domain honey

19.04.2016 //// Seite 42WPS - Workplace Solutions GmbH

UNKLARE STRUKTUREN IN DER ACHITEKTUR

Page 42: Its all about the domain honey

19.04.2016 //// Seite 43WPS - Workplace Solutions GmbH

GROSSE ZYKLEN VERSCHMUTZEN DAS SYSTEM

119 Klassen aus 4 Komponenten

+ 28 weitere Klassen

Page 43: Its all about the domain honey

19.04.2016 //// Seite 44WPS - Workplace Solutions GmbH

GROSSE ZYKLEN VERSCHMUTZEN DAS SYSTEM

327 Klassen aus 8

Komponenten

brauchen sich gegenseitig

Page 44: Its all about the domain honey

19.04.2016 //// Seite 45WPS - Workplace Solutions GmbH

Page 45: Its all about the domain honey

19.04.2016 //// Seite 46WPS - Workplace Solutions GmbH

GROSSE PROJEKTE

Erfordern mehrere Teams

Entwicklung findet parallel statt

Jedes Team korrespondiert mit einem Teil des Modells

Ein großes Modell?

Page 46: Its all about the domain honey

19.04.2016 //// Seite 47WPS - Workplace Solutions GmbH

KEIN GROSSES VEREINHEITLICHTES MODELL

Die vollständige Domäne ist zu groß für ein einzelnes Modell

Bewusste Aufspaltung in Teilmodelle

Separate Modelle

können unabhängig entwickelt werden

Müssen den an sie gestellten

Anforderungen genügen

sollten klar abgegrenzt sein

Jedes Modell sollte klein genug sein, so

dass man es einem Team zuweisen kann

Page 47: Its all about the domain honey

19.04.2016 //// Seite 48WPS - Workplace Solutions GmbH

KONTEXTGRENZEN (BOUNDED CONTEXT)

Jedes Modell hat einen Kontext

Kontext = Grundsätzliche Voraussetzungen, damit Begriffe eine bestimmte

Bedeutung erhalten

Wird ein Modell aufgespalten, so ist für jedes Teilmodell eine Kontextdefinition

erforderlich

Setze explizite Grenzen in der…

Organisation von Teams

Benutzung von Teilen der

Applikation

Codebasis

Entwicklung von

Datenbank-Schemas

Page 48: Its all about the domain honey

19.04.2016 //// Seite 49WPS - Workplace Solutions GmbH

LIVING IN A BOX

Erhalte die Konsistenz innerhalb der Grenzen

Keine Ablenkung durch äußere Angelegenheiten

Freie Gestaltung eines Teilmodells durch das zugehörige Team

Kenne die Restriktionen

Bleibe innerhalb der Modellgrenzen

Häufig werden Wertobjekte für die

Kontext-Interkommunikation verwendet

Page 49: Its all about the domain honey

19.04.2016 //// Seite 50WPS - Workplace Solutions GmbH

KONTEXTÜBERSICHT (CONTEXT MAP)

Jedes Team kennt seinen Kontextgrenzen. Wie steht es um die anderen?

Eine Kontextübersicht skizziert

Die verschiedenen abgegrenzten Kontexte

ihre wechselseitigen Beziehungen

Abgegrenzte Kontexte sollten

benannt sein.

Page 50: Its all about the domain honey

19.04.2016 //// Seite 51WPS - Workplace Solutions GmbH

SHARED KERNEL

Teams verwenden mitunter ähnliche Modelle.

Um Duplizierung zu vermeiden, einigen sich diese Teams auf ein gemeinsam

genutztes Teilmodell, den Shared Kernel.

Wird dieser Shared Kernel weiterentwickelt, werden alle beteiligten Teams mit

einbezogen.

Die Kontexte der Teams bleiben weiterhin voneinander abgegrenzt.

Address

Bank Data

Page 51: Its all about the domain honey

19.04.2016 //// Seite 52WPS - Workplace Solutions GmbH

MICROSERVICES AND SELF-CONTAINED SYSTEMS

Micro-service A

UI

Entities

Value Objects

Services

Micro-service B

UI

Entities

Value Objects

Services

Micro-service C

UI

Entities

Value Objects

Services

Tech

nis

che

Sch

ich

tun

g

Value

ObjectValue

Object

? ?

Page 52: Its all about the domain honey

19.04.2016 //// Seite 53WPS - Workplace Solutions GmbH

Page 53: Its all about the domain honey

19.04.2016 //// Seite 54WPS - Workplace Solutions GmbH

MOB-ARCHITEKTUR-REFACTORING

Page 54: Its all about the domain honey

Vielen Dank für Ihre Aufmerksamkeit!

www.langlebige-softwarearchitektur.de

Dr. Carola LilienthalMitglied der

Geschäftsleitung

[email protected]

www.wps.de

+49 170 184 77 11

Diplom-Informatikerin

@cairolali