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
230
xMolecules
Living architecture documentation
Henning Schwentner
December 01, 2022
Tweet
Share
More Decks by Henning Schwentner
See All by Henning Schwentner
Domain-Driven Design (Tutorial)
hschwentner
13
22k
Domain-Driven Transformation
hschwentner
2
2k
Software Architecture
hschwentner
6
2.2k
Model Pollution
hschwentner
1
150
Value and Record Types
hschwentner
1
1k
Domain Storytelling
hschwentner
4
2.6k
UNIX, Linux, and Command Line Basics
hschwentner
0
150
From Legacy to Cloud
hschwentner
0
190
Überzeugen
hschwentner
7
1.2k
Other Decks in Programming
See All in Programming
Using AI Tools Around Software Development
inouehi
0
1.2k
Go Modules: From Basics to Beyond / Go Modulesの基本とその先へ
kuro_kurorrr
0
120
F#で自在につくる静的ブログサイト - 関数型まつり2025
pizzacat83
0
300
Create a website using Spatial Web
akkeylab
0
290
[初登壇@jAZUG]アプリ開発者が気になるGoogleCloud/Azure+wasm/wasi
asaringo
0
130
つよそうにふるまい、つよい成果を出すのなら、つよいのかもしれない
irof
1
290
DroidKnights 2025 - 다양한 스크롤 뷰에서의 영상 재생
gaeun5744
3
260
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
230
Claude Codeの使い方
ttnyt8701
1
110
赤裸々に公開。 TSKaigiのオフシーズン
takezoux2
0
130
UPDATEがシステムを複雑にする? イミュータブルデータモデルのすすめ
shimomura
1
550
エラーって何種類あるの?
kajitack
5
150
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
Unsuck your backbone
ammeep
671
58k
Music & Morning Musume
bryan
46
6.6k
How GitHub (no longer) Works
holman
314
140k
Gamification - CAS2011
davidbonilla
81
5.3k
Code Reviewing Like a Champion
maltzj
524
40k
Embracing the Ebb and Flow
colly
86
4.7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
Visualization
eitanlees
146
16k
Balancing Empowerment & Direction
lara
1
310
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
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]