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
Avoiding the mud - Symfony Live London
Search
Richard Miller
September 21, 2013
Technology
7
740
Avoiding the mud - Symfony Live London
Richard Miller
September 21, 2013
Tweet
Share
More Decks by Richard Miller
See All by Richard Miller
Introduction to Symfony2 - DrupalCamp London 2014
richardmiller
0
220
Avoiding the mud
richardmiller
22
11k
better searching with elasticsearch - PHPConfPL
richardmiller
2
490
better searching with elasticsearch
richardmiller
2
270
What do I get from the full stack framework?
richardmiller
1
1.4k
Advanced Service Container Utilization
richardmiller
4
1.1k
Dependency Injection and the Symfony2 Service Container
richardmiller
9
13k
Other Decks in Technology
See All in Technology
Platform Engineering for Software Developers and Architects
syntasso
1
510
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
180
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
950
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
複雑なState管理からの脱却
sansantech
PRO
1
140
【若手エンジニア応援LT会】ソフトウェアを学んできた私がインフラエンジニアを目指した理由
kazushi_ohata
0
150
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
990
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
What's in a price? How to price your products and services
michaelherold
243
12k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Practical Orchestrator
shlominoach
186
10k
Into the Great Unknown - MozCon
thekraken
32
1.5k
How STYLIGHT went responsive
nonsquared
95
5.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Transcript
AVOIDING THE MUD by Richard Miller http://www.flickr.com/photos/burge5000/22568539/
@mr_r_miller http://www.richardmiller.co.uk
http://www.flickr.com/photos/brostad/8583990904
http://www.flickr.com/photos/dominik99/384027019
http://www.flickr.com/photos/jasmeet/2158002974
Bundles For Everything? http://www.flickr.com/photos/jarkel/2288176
Separate Domain Model From Bundles http://www.flickr.com/photos/30666161@N05/3705814710
HumanResourcesBundle
HumanResourcesBundle HumanResources
HumanResourcesBundle HumanResources
http://www.flickr.com/photos/26582481@N08/3040936355 Enough?
Still Tightly Coupled
AbsenceEntity Request Absence Form Cancel Absence Form Approve Absence Form
Change Absence Type Form
Sensio\HumanResources\Absence\AbsenceEntity: properties: reason: - NotBlank: { groups: [cancellation] } -
Length: { max: 300, groups: [cancellation] }
AbsenceEntity Request Absence Form Cancel Absence Form Approve Absence Form
Change Absence Type Form Request Absence Command Cancel Absence Command Approve Absence Command Change Absence Type Command
What About Templates?
AbsenceEntity upcoming .html .twig details .html .twig calendar .html .twig
unapproved .html .twig
{% if absence.endDate < date() %} past {% else %}
absence.status {% endif %} getDisplayStatus() AbsenceEntity getEndDate() getStatus()
{% if absence.endDate < date() %} past {% else %}
absence.status {% endif %} getDisplayStatus() AbsenceEntity getEndDate() getStatus()
{{ absence.displayStatus }} getDisplayStatus() AbsenceEntity getEndDate() getStatus() getDisplayStatus()
{{ absence.displayStatus }} getDisplayStatus() AbsenceEntity getEndDate() getStatus() getDisplayStatus()
AbsenceEntity Request Absence Form Cancel Absence Form Approve Absence Form
Change Absence Type Form Absence View upcoming .html .twig details .html .twig calendar .html .twig unapproved .html .twig
AbsenceEntity Request Absence Form Cancel Absence Form Approve Absence Form
Change Absence Type Form Absence View upcoming .html .twig details .html .twig calendar .html .twig unapproved .html .twig getStatus()
Unapproved Absence View Calendar View AbsenceEntity Request Absence Form Cancel
Absence Form Approve Absence Form Change Absence Type Form Upcoming Absences View Absence Details View upcoming .html .twig details .html .twig calendar .html .twig unapproved .html .twig
SRP
Behaviour Not State
Request Absence Controller Absence Entity setReason($reason) setStatus(AbsenceEntity::CANCELLED) setCancellationDate(new DateTime()) Cancel
Absence Command getReason()
Request Absence Controller Absence Entity cancel($reason) Cancel Absence Command getReason()
Cancel Absence Command Absence Entity Validate internal consistency Validate user
input
CancelAbsenceComm andHandler Cancel Absence Command Handler AbsenceEntity cancel($reason) handle($command) Request
Absence Controller Absence Entity cancel($reason) Cancel Absence Command
Infrastructure?
Absence Repository (Interface) findById($id) findUpcomingByMember($member) findAllByMember($member) Doctrine ORM Absence Repository
Doctrine ODM Absence Repository Guzzle Client Absence Repository Infrastructure Domain
AbsenceEntity Absence Repository Domain Bundle Service Config Infrastructure Doctrine ORM
Absence Repository Mapping Config
Absence Repository (Interface) findById($id) findUpcomingByMember($member) findAllByMember($member) add(AbsenceEntity $absence)
Events
OnUpdate Event AbsenceEntity Dispatches
OnUpdate Event AbsenceEntity Dispatches
Absence Cancelled Event Cancel Absence Command Handler Dispatches
Absence Cancelled Event In Memory Listener Immediate Action Place In
Messaging Queue Listens
Absence Cancelled Event Flush Listener Listens Absence Approved Event Domain
Infrastructure Listens
Separating Commands From Queries
Command Command Handler Entity Datastore
Datastore View Datastore View Datastore Command Command Handler Entity Event
Datastore View Datastore View Datastore Command Command Handler Entity View
Template Event
Separating Bundles Horizontally
Non-application Specific Code
HumanResources CustomLoggingBundle HumanResourcesBundle
HumanResourcesBundle HumanResources CustomLoggingBundle CustomLogging CustomLoggingBundle CustomLoggingBundle CustomLogging HumanResourcesBundle
HumanResources CustomLoggingBundle CustomLogging CustomLoggingBundle CustomLoggingBundle CustomLogging If it must! HumanResourcesBundle
HumanResources CustomLoggingBundle CustomLogging CustomLoggingBundle CustomLoggingBundle CustomLogging HumanResourcesBundle
Separating By Context
AbsencePlannerBundle AbsencePlanner CustomLoggingBundle CustomLogging CustomLoggingBundle RecruitmentBundle Recruitment
Message Queue/REST AbsencePlannerBundle AbsencePlanner CustomLoggingBundle CustomLogging CustomLoggingBundle RecruitmentBundle Recruitment
CustomLoggingBundle CustomLogging CustomLoggingBundle RecruitmentBundle Recruitment Off the shelf Package Message
Queue/REST Message Queue/REST AbsencePlannerBundle AbsencePlanner
Separate Commonality
AbsencePlannerBundle AbsencePlanner RecruitmentBundle Recruitment AbsencePlannerBundle AbsencePlanner CustomLoggingBundle CustomLogging CustomLoggingBundle RecruitmentBundle
Recruitment User Management
!= Staff Member Entity User Entity
AbsencePlannerBundle AbsencePlanner AbsencePlannerBundle AbsencePlanner CustomLoggingBundle CustomLogging CustomLoggingBundle RecruitmentBundle Recruitment UserManagementBundle
Now?
http://www.flickr.com/photos/mtsofan/8313606885
https://github.com/beberlei/litecqrs-php http://behat.org/
http://williamdurand.fr/ http://verraes.net/#blog http://www.whitewashing.de/
QUESTIONS?