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
160
xMolecules
Living architecture documentation
Henning Schwentner
December 01, 2022
Tweet
Share
More Decks by Henning Schwentner
See All by Henning Schwentner
Domain-Driven Transformation
hschwentner
2
1.7k
Model Pollution
hschwentner
1
37
Domain-Driven Design (Tutorial)
hschwentner
13
21k
Software Architecture
hschwentner
7
1.9k
Value and Record Types
hschwentner
1
950
Domain Storytelling
hschwentner
4
2.3k
UNIX, Linux, and Command Line Basics
hschwentner
0
92
From Legacy to Cloud
hschwentner
0
130
Überzeugen
hschwentner
7
1.1k
Other Decks in Programming
See All in Programming
個人開発で使ってるやつを紹介する回
yohfee
1
520
tsconfig.jsonの最近の新機能 ファイルパス編
uhyo
6
1.1k
API Platform for Laravel
dunglas
1
1.2k
CDKを活用した 大規模コンテナ移行 プロジェクトの紹介
yoyoyopg
0
220
グローバルなソフトウェアテスト組織における課題と戦略 / Challenges and Strategies in a Global Software Testing Organization #mf_techday
imtnd
0
210
標準ライブラリの動向とイテレータのパフォーマンス
makki_d
3
180
Beyond the RuboCop Defaults
koic
2
460
RDBの世界をぬりかえていくモデルグラフDB〜truncus graphによるモデルファースト開発〜
jurabi
0
110
ファーストペンギンBot @Qiita Hackathon 2024 予選
dyson_web
0
200
Cloud Adoption Frameworkにみる組織とクラウド導入戦略(縮小版)
tomokusaba
1
120
Findy - エンジニア向け会社紹介 / Findy Letter for Engineers
findyinc
4
93k
クラウドサービスの 利用コストを削減する技術 - 円安の真南風を感じて -
pyama86
3
230
Featured
See All Featured
Design by the Numbers
sachag
277
19k
Creatively Recalculating Your Daily Design Routine
revolveconf
216
12k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.3k
Git: the NoSQL Database
bkeepers
PRO
425
64k
The Art of Programming - Codeland 2020
erikaheidi
48
13k
Why Our Code Smells
bkeepers
PRO
334
57k
The Brand Is Dead. Long Live the Brand.
mthomps
53
38k
Art, The Web, and Tiny UX
lynnandtonic
294
20k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
278
13k
The Mythical Team-Month
searls
218
43k
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]