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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Henning Schwentner
December 01, 2022
Programming
280
3
Share
xMolecules
Living architecture documentation
Henning Schwentner
December 01, 2022
More Decks by Henning Schwentner
See All by Henning Schwentner
Event Storming
hschwentner
3
1.4k
Software Architecture
hschwentner
6
2.5k
Model Pollution
hschwentner
1
290
Domain-Driven Design (Tutorial)
hschwentner
13
22k
Domain-Driven Transformation
hschwentner
2
2.2k
Value and Record Types
hschwentner
1
1.1k
Domain Storytelling
hschwentner
4
2.9k
UNIX, Linux, and Command Line Basics
hschwentner
0
200
From Legacy to Cloud
hschwentner
0
250
Other Decks in Programming
See All in Programming
Transactional Change Stream Processing With Debezium and Apache Flink
gunnarmorling
1
110
Agent Skills を社内で育てる仕組み作り
jackchuka
1
2.2k
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
380
CLIであることを活かしたGitHub Copilot CLI活用術 / GitHub Copilot CLI Pro Tips & Tricks
nao_mk2
1
450
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
5
780
Sans tests, vos agents ne sont pas fiables
nabondance
0
140
Skillは並べた。動かなかった。契約で繋いだ。— 65個のSkillから、自走する開発サイクルへ
junholee
0
680
ReactとSvelteのその先、Ripple-TS / Beyond React and Svelte: Ripple-TS
ssssota
2
490
AIエージェントの隔離技術の徹底比較
kawayu
0
380
書き換えて学ぶTemporal #fukts
pirosikick
2
380
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
140
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
1
370
Featured
See All Featured
The Curse of the Amulet
leimatthew05
1
12k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
120
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Building the Perfect Custom Keyboard
takai
2
770
Color Theory Basics | Prateek | Gurzu
gurzu
0
310
Information Architects: The Missing Link in Design Systems
soysaucechin
0
930
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
370
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
300
Producing Creativity
orderedlist
PRO
348
40k
Ruling the World: When Life Gets Gamed
codingconduct
0
230
Side Projects
sachag
455
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]