Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Upcoming SlideShare
Loading in...5
×
 

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

on

  • 676 views

 

Statistics

Views

Total Views
676
Views on SlideShare
676
Embed Views
0

Actions

Likes
1
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013 Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013 Presentation 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 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