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
Specing interactors con BDD PHPSpec2 y YOLO fra...
Search
cordoval
October 04, 2013
Technology
6.1k
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Specing interactors con BDD PHPSpec2 y YOLO framework
DDD inside :)
cordoval
October 04, 2013
More Decks by cordoval
See All by cordoval
Symfony Components in the Wild Drupal Jungle
cordoval
1
2.4k
Other Decks in Technology
See All in Technology
トークンマネジメントでAIにとって働きやすい環境を実現する
hikaruegashira
0
120
Digitization部 紹介資料
sansan33
PRO
2
7.7k
AI・HPC開発を支えるGPU環境の新しい選択肢 液冷GPUシステム「AquSys」の取り組み
gpuunite_official
0
130
モノリス Rails でも日中に rails db:migrate を走らせたい! / Daytime rails db:migrate on Monolithic Rails!
euglena1215
4
650
その“隠したつもり”が命取り ── 自前と平文をやめて「正解」に委ねる
kuroneko13
0
130
Genie Codeハンズオン応用編
taka_aki
0
130
【書籍出版記念】 10周回って、エージェント開発は RAGがすべてだった。〜RAGの歴史と開発現場で見えた実践知〜
akiratameto
1
290
도구에서 동료까지: 10년차 AI 스타트업의 AI 적응기
inureyes
PRO
1
250
Bits AI を制するものは Datadog を制す / The player that controls Bits AI, controls Datadog
kaminashi
0
140
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
1.5k
コネクションをピン留めさせずに SELECTクエリのタイムアウトを設定した話
codmoninc
0
170
まちスペース®とデジタルツインと「まちづくり」
hiro_ogi
0
130
Featured
See All Featured
Accessibility Awareness
sabderemane
1
180
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
First, design no harm
axbom
PRO
2
1.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
330
How GitHub (no longer) Works
holman
316
150k
GitHub's CSS Performance
jonrohan
1033
470k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
390
Discover your Explorer Soul
emna__ayadi
2
1.3k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
210
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
410
Transcript
Specking Interactors with PHPSpec and YOLO Toward the scorners he
is scornful, but to the humble he gives favor. ~ Proverbs 3:34 Friday, October 4, 13
Take control of your project and live a simpler life
Toward the scorners he is scornful, but to the humble he gives favor. ~ Proverbs 3:34 Friday, October 4, 13
Framework != Domain Friday, October 4, 13
Test First Friday, October 4, 13
Domain Domain Friday, October 4, 13
Implementations are Details Friday, October 4, 13
http://www.austinchronicle.com/binary/d294/SS.Hook._leftsideonly_.jpg Friday, October 4, 13
http://www.collider.com/wp-content/uploads/Inception-movie-poster-2.jpg Friday, October 4, 13
http://static.guim.co.uk/sys-images/Film/Pix/pictures/2008/06/06/matrix460.jpg Friday, October 4, 13
Signs of Inception Friday, October 4, 13
Our Framework The Best Friday, October 4, 13
Our Practices The Best Friday, October 4, 13
Our Community never makes mistakes Friday, October 4, 13
Framework is convenient Friday, October 4, 13
But we are not solving The Problem Friday, October 4,
13
Friday, October 4, 13
Friday, October 4, 13
Friday, October 4, 13
Friday, October 4, 13
Domain Friday, October 4, 13
Domain Expert Friday, October 4, 13
BDD Friday, October 4, 13
BDD Tools Behat, PhpSpec Friday, October 4, 13
but DDD is for Large Systems ... Friday, October 4,
13
Friday, October 4, 13
show me how... Friday, October 4, 13
Friday, October 4, 13
Problem: some don’t want to pay for certification exams, so
let’s build a community site for those exams. Friday, October 4, 13
Before we jump into the sauce: Find a qualified examiner,
could be a real educator if not then try to become one Friday, October 4, 13
Spec First ↝ BDD + DDD Feature: student can take
an exam Scenario: student takes an exam Given student starts an exam And student is presented with a question When student answers to question ... Then student ends exam and gets graded Friday, October 4, 13
Modeling feature DSL BDD Scenario Learning Process Friday, October 4,
13
Modeling feature DSL entity service repository interactor (use case) port
value object BDD Scenario Support BDD Learning Process Friday, October 4, 13
Modeling feature DSL entity service repository interactor (use case) port
value object Exam Repository Attempt Repository Attempt Question Exam Grader Converter ShowAll Exams Grade Attempt BDD Scenario BDD Spec Support BDD Learning Process Friday, October 4, 13
Modeling feature DSL entity service repository interactor (use case) port
value object Exam Repository Attempt Repository Attempt Question Exam Grader Converter ShowAll Exams Grade Attempt BDD Scenario BDD Spec Support BDD DDD Breaking and Fixing Specs Learning Process Friday, October 4, 13
Modeling feature DSL entity service repository interactor (use case) port
value object Exam Repository Attempt Repository Attempt Question Exam Grader Converter ShowAll Exams Grade Attempt BDD Scenario BDD Spec Support BDD DDD Refactoring Behavior DDD Breaking and Fixing Specs Learning Process Friday, October 4, 13
Learning Process Friday, October 4, 13
Folder Structure To convey: - inversion of dependencies - make
dependencies explicit - domain and infrastructure separation - bounded context separation Friday, October 4, 13
~ tree -L 6 !"" features # !"" student_takes_exam.feature #
$"" teacher_builds_exam.feature !"" spec # $"" Simulator # !"" Domain # # !"" Model # # # $"" Exam # # # !"" AttemptSpec.php # # # !"" ExamSpec.php # # # !"" OptionSpec.php # # # $"" QuestionSpec.php # # !"" Port # # # !"" AnswerSpec.php # # # !"" ExamSpec.php Notice these are specs! Friday, October 4, 13
~ tree -L 6 !"" features # !"" student_takes_exam.feature #
$"" teacher_builds_exam.feature !"" spec # $"" Simulator # !"" Domain # # !"" Model # # # $"" Exam # # # !"" AttemptSpec.php # # # !"" ExamSpec.php # # # !"" OptionSpec.php # # # $"" QuestionSpec.php # # !"" Port # # # !"" AnswerSpec.php # # # !"" ExamSpec.php Friday, October 4, 13
~ tree -L 6 !"" features # !"" student_takes_exam.feature #
$"" teacher_builds_exam.feature !"" spec # $"" Simulator # !"" Domain # # !"" Model # # # $"" Exam # # # !"" AttemptSpec.php # # # !"" ExamSpec.php # # # !"" OptionSpec.php # # # $"" QuestionSpec.php # # !"" Port # # # !"" AnswerSpec.php # # # !"" ExamSpec.php Friday, October 4, 13
~ tree -L 6 ... # # !"" Port #
# # !"" AnswerSpec.php # # # !"" ExamSpec.php # # # $"" ExamsSpec.php # # !"" Services # # # !"" ExamsConverterSpec.php # # # !"" GraderSpec.php # # # $"" PrototypeManagerSpec.php # # !"" Support # # # $"" StudentHelperSpec.php # # $"" UseCase # # !"" GradesAttemptSpec.php Friday, October 4, 13
~ tree -L 6 ... # # !"" Port #
# # !"" AnswerSpec.php # # # !"" ExamSpec.php # # # $"" ExamsSpec.php # # !"" Services # # # !"" ExamsConverterSpec.php # # # !"" GraderSpec.php # # # $"" PrototypeManagerSpec.php # # !"" Support # # # $"" StudentHelperSpec.php # # $"" UseCase # # !"" GradesAttemptSpec.php Friday, October 4, 13
~ tree -L 6 ... # # !"" Port #
# # !"" AnswerSpec.php # # # !"" ExamSpec.php # # # $"" ExamsSpec.php # # !"" Services # # # !"" ExamsConverterSpec.php # # # !"" GraderSpec.php # # # $"" PrototypeManagerSpec.php # # !"" Support # # # $"" StudentHelperSpec.php # # $"" UseCase # # !"" GradesAttemptSpec.php Friday, October 4, 13
~ tree -L 6 ... # $"" Infrastructure # !""
Cilex # # !"" Command # # # $"" ShowAllExamsCommand.php # # !"" Console # # # $"" Runner.php # # !"" Provider # # # $"" SimulatorServiceProvider.php # # $"" config.yml Friday, October 4, 13
~ tree -L 6 ... # $"" Infrastructure | ...
# !"" Persistence # # !"" Doctrine # # # $"" OrmExamRepository.php # # !"" InMemoryAttemptRepository.php # # !"" InMemoryExamRepository.php # # $"" PDO # # $"" PdoExamRepository.php # !"" Symfony # # $"" Bundle # # $"" SimulatorBundle # $"" Yolo # $"" Controller # $"" ExamController.php Friday, October 4, 13
~ tree -L 6 ... # $"" Infrastructure | ...
# !"" Persistence # # !"" Doctrine # # # $"" OrmExamRepository.php # # !"" InMemoryAttemptRepository.php # # !"" InMemoryExamRepository.php # # $"" PDO # # $"" PdoExamRepository.php # !"" Symfony # # $"" Bundle # # $"" SimulatorBundle # $"" Yolo # $"" Controller # $"" ExamController.php Friday, October 4, 13
~ tree -L 6 ... # $"" Infrastructure | ...
# !"" Persistence # # !"" Doctrine # # # $"" OrmExamRepository.php # # !"" InMemoryAttemptRepository.php # # !"" InMemoryExamRepository.php # # $"" PDO # # $"" PdoExamRepository.php # !"" Symfony # # $"" Bundle # # $"" SimulatorBundle # $"" Yolo # $"" Controller # $"" ExamController.php Friday, October 4, 13
What if I ask you which classes implement the features?
Friday, October 4, 13
Folder Structure ~ tree -L 6 ... # # !""
Port # # # !"" AnswerSpec.php # # # !"" ExamSpec.php # # # $"" ExamsSpec.php # # !"" Services # # # !"" ExamsConverterSpec.php # # # !"" GraderSpec.php # # # $"" PrototypeManagerSpec.php # # !"" Support # # # $"" StudentHelperSpec.php # # $"" UseCase # # !"" GradesAttemptSpec.php This bring us back to interactors/use cases Friday, October 4, 13
Friday, October 4, 13
Friday, October 4, 13
Domain ↝ Domain - intention - expressive - explicit Friday,
October 4, 13
Domain ↝ Domain Friday, October 4, 13
Domain ↝ Domain Friday, October 4, 13
Show what you did :) Friday, October 4, 13
"repositories": [ { "type": "vcs", "url": "
[email protected]
:cordoval/ExamSimulator" } ], "require":
{ "igorw/yolo": "dev-master", "cordoval/exam-simulator": "dev-master" }, Friday, October 4, 13
~ php bin/console exams:show - yolo - part I -
yolo - part II All exams displayed Friday, October 4, 13
http:// craftitonline.com END Friday, October 4, 13