Dyno

Architecture Patterns with Python

Harry Percival / Bob Gregory

Python プロジェクトにおけるアーキテクチャパターンについて解説した書籍です。

有名な Hexagonal Architecture や Clean Architecture 、 DDD ( Domain-Driven Design )を Python に適用する方法について、具体例を用いながら詳細かつ丁寧に解説してあります。

Appendix を除く目次は以下のとおりです。

Preface
Introduction
I. Building an Architecture to Support Domain Modeling
 1. Domain Modeling
 2. Repository Pattern
 3. A Brief Interlude: On Coupling and Abstractions
 4. Our First Use Case: Flask API and Service Layer
 5. TDD in High Gear and Low Gear
 6. Unit of Work Pattern
 7. Aggregates and Consistency Boundaries
II. Event-Driven Architecture
 8. Events and the Message Bus
 9. Going to Town on the Message Bus
 10. Commands and Command Handler
 11. Event-Driven Architecture: Using Events to Integrate Microservices
 12. Command-Query Responsibility Segregation (CQRS)
 13. Dependency Injection (and Bootstrapping)
Epilogue

アーキテクチャについての知識・経験があまり無い人でもわかりやすく学べる書籍です。 試行錯誤の末の完成形をいきなり見せるのではなく、理由・根拠を説明しながらステップ・バイ・ステップで少しずつアーキテクチャを改善していく過程を見せてくれます。

ただし、 DDD や Clean Architecture についてまったく知らない状態だとおそらく難しいので、前提知識としてそのあたりのことをある程度知っておく必要があります。

アーキテクチャ関連の本が Python には少ないので希少な一冊だと思います。

著者は Python × TDD の良書「 Test-Driven Development with Python 」の著者でもある Harry Percival 氏です。