Upload
cordoval
View
915
Download
1
Tags:
Embed Size (px)
Citation preview
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
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
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 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
ExamRepository
AttemptRepository
Attempt QuestionExam
Grader Converter
ShowAllExams
GradeAttempt
BDD ScenarioBDD Spec
Support BDD
Learning Process
Friday, October 4, 13
Modeling
feature DSL entity
service
repository
interactor(use case)
port
value object
ExamRepository
AttemptRepository
Attempt QuestionExam
Grader Converter
ShowAllExams
GradeAttempt
BDD ScenarioBDD 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
ExamRepository
AttemptRepository
Attempt QuestionExam
Grader Converter
ShowAllExams
GradeAttempt
BDD ScenarioBDD Spec
Support BDD
DDD Refactoring Behavior 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
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
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
"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 IIAll exams displayed
Friday, October 4, 13
http://craftitonline.com
END
Friday, October 4, 13