SlideShare a Scribd company logo
1 of 58
Download to read offline
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
BDD Scenario

feature

DSL

Learning Process
Friday, October 4, 13
Modeling
repository

BDD Scenario

feature

DSL
Support BDD

entity

value
object

service

interactor
(use case)

port

Learning Process
Friday, October 4, 13
Modeling
Exam
Repository

Attempt
Repository

Exam

Attempt

service

Grader

Converter

interactor
(use case)

ShowAll
Exams

Grade
Attempt

repository

BDD Scenario

feature

DSL
Support BDD

entity

BDD Spec

value
object

port

Learning Process
Friday, October 4, 13

Question
Modeling
Exam
Repository

Attempt
Repository

Exam

Attempt

service

Grader

Converter

interactor
(use case)

ShowAll
Exams

Grade
Attempt

repository

BDD Scenario

feature

DSL
Support BDD

entity

BDD Spec

value
object

port

Learning Process
Friday, October 4, 13

Question

DDD Breaking and Fixing Specs
Modeling
Exam
Repository

Attempt
Repository

Exam

Attempt

service

Grader

Converter

interactor
(use case)

ShowAll
Exams

Grade
Attempt

repository

BDD Scenario

feature

DSL
Support BDD

DDD Refactoring Behavior

entity

BDD Spec

value
object

port

Learning Process
Friday, October 4, 13

Question

DDD Breaking and Fixing Specs
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

Friday, October 4, 13

Notice these are specs!
~
!""
#  
#  
!""
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  

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
...
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  

Friday, October 4, 13

6
!""
#  
#  
#  
!""
#  
#  
#  
!""
#  
$""

Port
!"" AnswerSpec.php
!"" ExamSpec.php
$"" ExamsSpec.php
Services
!"" ExamsConverterSpec.php
!"" GraderSpec.php
$"" PrototypeManagerSpec.php
Support
$"" StudentHelperSpec.php
UseCase
!"" GradesAttemptSpec.php
~ tree -L
...
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  

Friday, October 4, 13

6
!""
#  
#  
#  
!""
#  
#  
#  
!""
#  
$""

Port
!"" AnswerSpec.php
!"" ExamSpec.php
$"" ExamsSpec.php
Services
!"" ExamsConverterSpec.php
!"" GraderSpec.php
$"" PrototypeManagerSpec.php
Support
$"" StudentHelperSpec.php
UseCase
!"" GradesAttemptSpec.php
~ tree -L
...
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  

Friday, October 4, 13

6
!""
#  
#  
#  
!""
#  
#  
#  
!""
#  
$""

Port
!"" AnswerSpec.php
!"" ExamSpec.php
$"" ExamsSpec.php
Services
!"" ExamsConverterSpec.php
!"" GraderSpec.php
$"" PrototypeManagerSpec.php
Support
$"" StudentHelperSpec.php
UseCase
!"" GradesAttemptSpec.php
~ tree -L 6
...
#  
#  
#  
#  
#  
#  
#  
#  
#  

Friday, October 4, 13

$"" Infrastructure
!"" Cilex
#   !"" Command
#   #   $"" ShowAllExamsCommand.php
#   !"" Console
#   #   $"" Runner.php
#   !"" Provider
#   #   $"" SimulatorServiceProvider.php
#   $"" config.yml
~ tree -L 6
...
#  
|
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  

Friday, October 4, 13

$"" Infrastructure
...
!"" Persistence
#   !"" Doctrine
#   #   $"" OrmExamRepository.php
#   !"" InMemoryAttemptRepository.php
#   !"" InMemoryExamRepository.php
#   $"" PDO
#  
$"" PdoExamRepository.php
!"" Symfony
#   $"" Bundle
#  
$"" SimulatorBundle
$"" Yolo
$"" Controller
$"" ExamController.php
~ tree -L 6
...
#  
|
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  

Friday, October 4, 13

$"" Infrastructure
...
!"" Persistence
#   !"" Doctrine
#   #   $"" OrmExamRepository.php
#   !"" InMemoryAttemptRepository.php
#   !"" InMemoryExamRepository.php
#   $"" PDO
#  
$"" PdoExamRepository.php
!"" Symfony
#   $"" Bundle
#  
$"" SimulatorBundle
$"" Yolo
$"" Controller
$"" ExamController.php
~ tree -L 6
...
#  
|
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  
#  

Friday, October 4, 13

$"" Infrastructure
...
!"" Persistence
#   !"" Doctrine
#   #   $"" OrmExamRepository.php
#   !"" InMemoryAttemptRepository.php
#   !"" InMemoryExamRepository.php
#   $"" PDO
#  
$"" PdoExamRepository.php
!"" Symfony
#   $"" Bundle
#  
$"" SimulatorBundle
$"" Yolo
$"" Controller
$"" ExamController.php
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": "git@github.com: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

More Related Content

Similar to Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013

Engineering culture
Engineering cultureEngineering culture
Engineering culture
Pamela Fox
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
Ran Mizrahi
 
Distributed percolator in elasticsearch
Distributed percolator in elasticsearchDistributed percolator in elasticsearch
Distributed percolator in elasticsearch
martijnvg
 
Implementing AutoComplete for Freemarker and Velocity languages in ACE Editor
Implementing AutoComplete for Freemarker and Velocity languages in ACE EditorImplementing AutoComplete for Freemarker and Velocity languages in ACE Editor
Implementing AutoComplete for Freemarker and Velocity languages in ACE Editor
peychevi
 

Similar to Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013 (20)

Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013
 
Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)
 
Engineering culture
Engineering cultureEngineering culture
Engineering culture
 
Ab(Using) the MetaCPAN API for Fun and Profit v2013
Ab(Using) the MetaCPAN API for Fun and Profit v2013Ab(Using) the MetaCPAN API for Fun and Profit v2013
Ab(Using) the MetaCPAN API for Fun and Profit v2013
 
Cooking an Omelette with Chef
Cooking an Omelette with ChefCooking an Omelette with Chef
Cooking an Omelette with Chef
 
Jenkins (war)stories
Jenkins (war)storiesJenkins (war)stories
Jenkins (war)stories
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
 
Hammering Responsive Web Design Into Shape
Hammering Responsive Web Design Into ShapeHammering Responsive Web Design Into Shape
Hammering Responsive Web Design Into Shape
 
Enterprise Maven Repository BOF
Enterprise Maven Repository BOFEnterprise Maven Repository BOF
Enterprise Maven Repository BOF
 
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
 
Puppet Camp Berlin 2014: Advanced Puppet Design
Puppet Camp Berlin 2014: Advanced Puppet DesignPuppet Camp Berlin 2014: Advanced Puppet Design
Puppet Camp Berlin 2014: Advanced Puppet Design
 
Intro to Angular.JS Directives
Intro to Angular.JS DirectivesIntro to Angular.JS Directives
Intro to Angular.JS Directives
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Docker
 
Contributing to WordPress
Contributing to WordPressContributing to WordPress
Contributing to WordPress
 
Distributed percolator in elasticsearch
Distributed percolator in elasticsearchDistributed percolator in elasticsearch
Distributed percolator in elasticsearch
 
Implementing AutoComplete for Freemarker and Velocity languages in ACE Editor
Implementing AutoComplete for Freemarker and Velocity languages in ACE EditorImplementing AutoComplete for Freemarker and Velocity languages in ACE Editor
Implementing AutoComplete for Freemarker and Velocity languages in ACE Editor
 
elasticsearch basics workshop
elasticsearch basics workshopelasticsearch basics workshop
elasticsearch basics workshop
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own Domain
 
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at OoyalaCassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013