Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
xMolecules
Search
Henning Schwentner
December 01, 2022
Programming
3
170
xMolecules
Living architecture documentation
Henning Schwentner
December 01, 2022
Tweet
Share
More Decks by Henning Schwentner
See All by Henning Schwentner
Model Pollution
hschwentner
1
84
Domain-Driven Transformation
hschwentner
2
1.8k
Domain-Driven Design (Tutorial)
hschwentner
13
21k
Software Architecture
hschwentner
6
2k
Value and Record Types
hschwentner
1
970
Domain Storytelling
hschwentner
4
2.4k
UNIX, Linux, and Command Line Basics
hschwentner
0
95
From Legacy to Cloud
hschwentner
0
150
Überzeugen
hschwentner
7
1.1k
Other Decks in Programming
See All in Programming
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
190
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
みんなでプロポーザルを書いてみた
yuriko1211
0
260
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
Jakarta EE meets AI
ivargrimstad
0
580
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
1
110
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Code Reviewing Like a Champion
maltzj
520
39k
GraphQLとの向き合い方2022年版
quramy
43
13k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
How to Ace a Technical Interview
jacobian
276
23k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
A designer walks into a library…
pauljervisheath
203
24k
Adopting Sorbet at Scale
ufuk
73
9.1k
Transcript
Starring Directed By Presented by With
None
None
https://hschwentner.io
@hschwentner
! " # $
@hschwentner
BankAccount withdraw() deposit() Amount
BankAccount withdraw() deposit() Amount
@hschwentner Domain-Driven Design Eric Evans
@hschwentner Entity vs. Value - Identity - Life cycle -
Can be mutable - No identity - Always immutable Contract Map Name Length 12.5 m “John Miller”
Entity Value Object Aggregate Service Factory Repository Tactical Design
«Entity» BankAccount withdraw() deposit() «Value Object» Amount
«stereotype» Value Object «stereotype» Entity ??? «stereotype» Identity
xMolecules
None
Hexagonal Architecture Layerered Architecture Onion Architecture Clean Architecture
@hschwentner How To Express Architecture?
class Account { public void deposit(Amount amount) //... public void
withdraw(Amount amount) //... }
class AccountEntity { public void deposit(Amount amount) //... public void
withdraw(Amount amount) //... }
class Account extends Entity { public void deposit(Amount amount) //...
public void withdraw(Amount amount) //... }
class Account extends Entity<IBAN> { public void deposit(Amount amount) //...
public void withdraw(Amount amount) //... }
import org.jmolecules.ddd.types.Entity; class Account extends Entity<IBAN> { public void deposit(Amount
amount) //... public void withdraw(Amount amount) //... }
@Entity class Account { public void deposit(Amount amount) //... public
void withdraw(Amount amount) //... }
import org.jmolecules.ddd.annotation.Entity; @Entity class Account { public void deposit(Amount amount)
//... public void withdraw(Amount amount) //... }
@hschwentner How To Express Architecture?
class Account { public void deposit(Amount amount) //... public void
withdraw(Amount amount) //... }
class AccountEntity { public void deposit(Amount amount) //... public void
withdraw(Amount amount) //... }
class Account : Entity { public void deposit(Amount amount) //...
public void withdraw(Amount amount) //... }
class Account : Entity<IBAN> { public void deposit(Amount amount) //...
public void withdraw(Amount amount) //... }
using NMolecules.DDD; class Account : Entity<IBAN> { public void deposit(Amount
amount) //... public void withdraw(Amount amount) //... }
[Entity] class Account { public void deposit(Amount amount) //... public
void withdraw(Amount amount) //... }
using NMolecules.DDD; [Entity] class Account { public void deposit(Amount amount)
//... public void withdraw(Amount amount) //... }
[Entity] class Account { [Identity] public IBAN IBAN { get;
} public void deposit(Amount amount) //... public void withdraw(Amount amount) //... }
@hschwentner How To Express Architecture?
class Account { public function deposit(Amount $amount) //... public function
withdraw(Amount $amount) //... }
class AccountEntity { public function deposit(Amount $amount) //... public function
withdraw(Amount $amount) //... }
class Account extends Entity { public function deposit(Amount $amount) //...
public function withdraw(Amount $amount) //... }
/** * @extends Entity<IBAN> */ class Account extends Entity {
public function deposit(Amount $amount) //... public function withdraw(Amount $amount) //... }
use PHPMolecules\DDD\Type\Entity; class Account extends Entity { public function deposit(Amount
$amount) //... public function withdraw(Amount $amount) //... }
#[Entity] class Account { public function deposit(Amount $amount) //... public
function withdraw(Amount $amount) //... }
use PHPMolecules\DDD\Annotation\Entity; #[Entity] class Account { public function deposit(Amount $amount)
//... public function withdraw(Amount $amount) //... }
@hschwentner Why Express Architecture?
Documentation Verification Boilerplate Reduction
@hschwentner Documentation
@hschwentner ! " «Entity» XXX «Value Object» YYY ??
None
@hschwentner Verification
@hschwentner value Architecture Rules entity allowed forbidden
None
@AnalyzeClasses(packagesOf = ArchitectureTests.class) class ArchitectureTests { @ArchTest ArchRule ddd =
JMoleculesDddRules.all(); }
None
PHPStan Psalm Phan PHPArkitect PHPArch
@hschwentner Boilerplate Reduction
@javax.persistence.Entity class BankAccount { /*...*/ } @javax.persistence.???.Embeddable class Amount {
/*...*/ }
@hschwentner jmolecules-bytebuddy jmolecules-jpa jmolecules-spring jmolecules-jackson jmolecules-intellij
@hschwentner Boilerplate Reduction
???
@hschwentner nmolecules-ef nmolecules-roslyn nmolecules-rider
@hschwentner Boilerplate Reduction
/** * @ORM\Entity * @ORM\Table(name="bank_accounts") */ class BankAccount { /**
* @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private IBAN iban; /*...*/ }
@hschwentner phpmolecules-doctrine phpmolecules-symphony phpmolecules-serializer phpmolecules-phpstorm
@hschwentner Installation
<dependency> <groupId>org.jmolecules</groupId> <artifactId>jmolecules-ddd</artifactId> <version>1.4.0</version> </dependency>
@hschwentner Installation
> dotnet add package NMolecules.DDD
// Install NMolecules.DDD as a Cake Addin #addin nuget:?package=NMolecules.DDD&version=0.2.1 //
Install NMolecules.DDD as a Cake Tool #tool nuget:?package=NMolecules.DDD&version=0.2.1
@hschwentner Installation
$ composer require --dev xmolecules/phpmolecules
@hschwentner LeasingNinja.io
None
Bibliography Evans, Eric. Domain-Driven Design: Tackling Complexity in the Heart
of Software. Boston: Addison-Wesley, 2004. Hofer, Stefan and Henning Schwentner. Domain Storytelling: a Collaborative, Visual, and Agile Way to Develop Domain-Driven Software. Boston: Addison-Wesley, 2022.
None
Henning Schwentner ⌂ https://hschwentner.io @hschwentner
[email protected]