SlideShare ist ein Scribd-Unternehmen logo
1 von 68
Downloaden Sie, um offline zu lesen
Albert Einstein
Learn from yesterday,
live for today,
hope for tomorrow.
The important thing
is not to stop questioning.
„
Test Driven

Development
Behavior Driven
Development
Domain Driven

Design
Test Driven

Development
Behavior Driven
Development
Domain Driven

Design
Don’t think about
that now
Architecture
Inspired by Shrek (and drugs ;)
Ogres
and Applications
are like onions
• Domain
• Application
• Infrastructure
• User Interface
They both have layers!
A long time ago in a bar
far, far away…
It is all about
Recipe
Let’s make
an App

for that
but…
explore
the domain
first!
48 hours later…
Version 1.0 features
• recipes search engine
• recipe drink photos
• ingredients list
• possibility to add new recipes (admin only)
• comments
• social media stufff
Domain
1
Examples
Feature: Create new drink recipe
Scenario: Create new drink recipe

Scenario: Attempt to create new drink recipe using too many liquids

Scenario: Attempt to create new drink without glass

Scenario: Attempt to add step about pouring to shaker without shaker

Scenario: Attempt to remove significant step from the recipe
/**
* @When I decide to create new recipe called :name
*/
public function iDecideToCreateNewRecipeCalled($name)
{
$this->recipe = new Recipe(new Name($name));
}
/**
* @When as first step I add: prepare :name glass with :capacity ml capacity
*/
public function asFirstStepIAddPrepareHighballGlassWithMlCapacity($name, $capacity)
{
$this->recipe->prepareTheGlass(new Name($name), new Capacity($capacity));
}
Modeling by examples
Im not sure
but something
is wrong here
Let’s try
with SPECS
RecipeSpec.php
it_has_a_name();
it_requires_preparing_a_glass_as_a_first_step();
it_allows_pouring_into_prepared_glass();
it_allows_filling_prepared_glass();
it_allowes_adding_ingredients_into_glass();
it_does_not_have_any_description_by_default();
GlassSpec.php
it_has_a_name();
it_is_standalone_by_default();
it_has_a_capacity();
it_can_be_filled_with_liquids();
it_cant_be_over_filled();
it_allows_to_stir_liquids();
IngredientSpec.php
CapacitySpec.php
AmountSpec.php
RecipeDescriptionSpec.php
Other SPECS
• Value Objects
• Entities
• Services
• Aggregates
Make it
SOLID
Single responsibility principle |
Open/closed principle | Liskov
substitution principle | Interface
segregation principle |
Dependency inversion principle |
Single responsibility principle |
Open/closed principle | Liskov
substitution principle | Interface
segregation principle |
Dependency inversion principle |
Single responsibility principle |
Open/closed principle | Liskov
substitution principle | Interface
segregation principle |
Dependency inversion principle |
Single responsibility principle |
Open/closed principle | Liskov
substitution principle | Interface
segregation principle |
Dependency inversion principle |
Single responsibility principle |
Open/closed principle | Liskov
substitution principle | Interface
segregation principle |
Dependency inversion principle |
Make it
Unbreakable
Domain (model)
2 Application
Think like a
programmer
Talk to me
• CreateNewRecipeCommand.php
• AddRecipeStepCommand.php
• RemoveRecipeStepCommand.php
• UpdateRecipeDescriptionCommand.php
• UploadRecipePhotoCommand.php
• PublishRecipeCommand.php
• Create New Recipe
• Add Recipe Step
• Remove Recipe Step
• Update Recipe Description
• Upload Recipe Photo
• Publish Recipe
• CreateNewRecipeCommand.php
• AddRecipeStepCommand.php
• RemoveRecipeStepCommand.php
• UpdateRecipeDescriptionCommand.php
• UploadRecipePhotoCommand.php
• PublishRecipeCommand.php
• Search Engine
• Autocomplete (Ingredients)
• Recipes Collection (Repository)
Well, sometimes
you have to ask…?
• Command Bus
• Command Handlers
• Recipe Serializer
Other things
• Filesystem
• SlugGenerator
<?php
class CreateNewRecipeCommand
{
/**
* @var string
*/
private $name;
/**
* @param string $name
*/
public function __construct($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function name()
{
return $this->name;
}
}
Immutable
commands
<?php
class CreateNewRecipeHandler
{
private $recipes;
private $recipeFactory;
public function __construct(Recipes $recipes, Factory $recipeFactory)
{
$this->recipes = $recipes;
$this->recipeFactory = $recipeFactory;
}
public function handle(CreateNewRecipeCommand $command)
{
$recipe = $this->recipeFactory->createRecipe($command->name());
if ($this->recipes->hasRecipeWithName($recipe->getName())) {
throw new RecipeAlreadyExistsException();
}
$this->recipes->add($recipe);
}
}
Wait
a minute…
<?php
/**
* @When I decide to create new recipe called :name
*/
public function iDecideToCreateNewRecipeCalled($name)
{
$command = new CreateNewRecipeCommand();
$command->name = $name;
$this->commandBus->handle($command);
$this->currentRecipeName = new Name($name);
}
/**
* @When as first step I add: prepare :name glass with :capacity ml capacity
*/
public function asFirstStepIAddPrepareHighballGlassWithMlCapacity($name, $capacity)
{
$command = new AddRecipeStepCommand();
$command->slug = $this->slugGenerator->generateFrom($this->currentRecipeName);
$command->action = RecipeActions::PREPARE_GLASS;
$command->name = $name;
$command->capacity = (int) $capacity;
$this->commandBus->handle($command);
}
Well done!
Application
3 Infrastructure
Just implement
interfaces
• FlySystemFilesystem
• InMemoryRepository
• FilesystemRepository
• SlugifySlugGenerator
• JsonSerializer
• ElasticSearchEngineAdapter
• DummySearchEngineAdapter
Interface
LEGO
Power Functions - Engine
Implementation
Literally nothing
for testing purpose only
Dummy 

implementation
4 User Interface
Connection
between
user and
application
Framework
based
• ROUTING
• TEMPLATING ENGINE
• SERVICE LOCATOR
• FORMS
• VALIDATION
• REQUEST RESPONSE WRAPPERS
Symfony 2
Laravel

Zend 2
Hybride?
Symfony 2 + Laravel?
Maybe with
shared service locator
• WEB APPLICATION
• CONSOLE APPLICATION
• REST API
• SOAP API
• GUI
Examples
User Interface
5 System
DOMAIN
APPLICATION
USER INTERFACE
I
N
F
R
A
S
T
R
U
C
T
U
R
E
System
My Drinks v 1.0
160 working hours
1 developer
A walk through
system layers
Story written by alcohol
http://twitter.com/norzechowicz

http://github.com/norzechowicz

norbert@orzechowicz.pl

http://phpers.pl
Norbert
Orzechowicz
https://github.com/norzechowicz/mydrinks
My Drinks Repository
http://zawarstwaabstrakcji.pl
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Using Cocoapods
Using CocoapodsUsing Cocoapods
Using Cocoapods
jeffreysambells
 

Was ist angesagt? (6)

ActionBar and Holo in Android 2+
ActionBar and Holo in Android 2+ActionBar and Holo in Android 2+
ActionBar and Holo in Android 2+
 
Using Cocoapods
Using CocoapodsUsing Cocoapods
Using Cocoapods
 
Calabash Andoird + Calabash iOS
Calabash Andoird + Calabash iOSCalabash Andoird + Calabash iOS
Calabash Andoird + Calabash iOS
 
Selenium for Jobseekers
Selenium for JobseekersSelenium for Jobseekers
Selenium for Jobseekers
 
Inspect The Uninspected
Inspect The UninspectedInspect The Uninspected
Inspect The Uninspected
 
Midwest PHP 2017 DevOps For Small team
Midwest PHP 2017 DevOps For Small teamMidwest PHP 2017 DevOps For Small team
Midwest PHP 2017 DevOps For Small team
 

Andere mochten auch

Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Moses Boudourides
 
Dye family room furniture selections
Dye family room furniture selectionsDye family room furniture selections
Dye family room furniture selections
Erica Peale
 
Dye family room furniture selections
Dye family room furniture selectionsDye family room furniture selections
Dye family room furniture selections
Erica Peale
 
Hasil pengamatan gum xantan
Hasil pengamatan gum xantanHasil pengamatan gum xantan
Hasil pengamatan gum xantan
Dn Ssd
 

Andere mochten auch (19)

Save Repository From Save
Save Repository From SaveSave Repository From Save
Save Repository From Save
 
PhpSpec extension points
PhpSpec extension pointsPhpSpec extension points
PhpSpec extension points
 
Mysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extensionMysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extension
 
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
 
Dye family room furniture selections
Dye family room furniture selectionsDye family room furniture selections
Dye family room furniture selections
 
Introduction to Lights
Introduction to LightsIntroduction to Lights
Introduction to Lights
 
The natural leadership talents of women
The natural leadership talents of womenThe natural leadership talents of women
The natural leadership talents of women
 
French vocab rehab
French vocab rehabFrench vocab rehab
French vocab rehab
 
Alternativas
AlternativasAlternativas
Alternativas
 
Goo Create: Interface Overview
Goo Create: Interface OverviewGoo Create: Interface Overview
Goo Create: Interface Overview
 
Letters From Kay
Letters From KayLetters From Kay
Letters From Kay
 
Multilayerity within multilayerity? On multilayer assortativity in social net...
Multilayerity within multilayerity? On multilayer assortativity in social net...Multilayerity within multilayerity? On multilayer assortativity in social net...
Multilayerity within multilayerity? On multilayer assortativity in social net...
 
Dye family room furniture selections
Dye family room furniture selectionsDye family room furniture selections
Dye family room furniture selections
 
Hasil pengamatan gum xantan
Hasil pengamatan gum xantanHasil pengamatan gum xantan
Hasil pengamatan gum xantan
 
[Up! Essência] Produtos
[Up! Essência] Produtos[Up! Essência] Produtos
[Up! Essência] Produtos
 
纯电动方程式赛车赞助企划书
纯电动方程式赛车赞助企划书纯电动方程式赛车赞助企划书
纯电动方程式赛车赞助企划书
 
Physical activity
Physical  activityPhysical  activity
Physical activity
 
Vivian Murciano Media Sales Director
Vivian Murciano Media Sales DirectorVivian Murciano Media Sales Director
Vivian Murciano Media Sales Director
 
Stmt trisakati kel.1
Stmt trisakati kel.1Stmt trisakati kel.1
Stmt trisakati kel.1
 

Ähnlich wie A walk through system layers

Emerging chef patterns and practices
Emerging chef patterns and practicesEmerging chef patterns and practices
Emerging chef patterns and practices
Owain Perry
 
Phpworks enterprise-php-1227605806710884-9
Phpworks enterprise-php-1227605806710884-9Phpworks enterprise-php-1227605806710884-9
Phpworks enterprise-php-1227605806710884-9
PrinceGuru MS
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Software, Inc.
 
Refactoring Legacy Code - true story
Refactoring Legacy Code - true storyRefactoring Legacy Code - true story
Refactoring Legacy Code - true story
Aki Salmi
 

Ähnlich wie A walk through system layers (20)

Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
 
CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011
 
[DevDay 2017] ReactJS Hands on - Speaker: Binh Phan - Developer at mgm techno...
[DevDay 2017] ReactJS Hands on - Speaker: Binh Phan - Developer at mgm techno...[DevDay 2017] ReactJS Hands on - Speaker: Binh Phan - Developer at mgm techno...
[DevDay 2017] ReactJS Hands on - Speaker: Binh Phan - Developer at mgm techno...
 
Emerging chef patterns and practices
Emerging chef patterns and practicesEmerging chef patterns and practices
Emerging chef patterns and practices
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
Phpworks enterprise-php-1227605806710884-9
Phpworks enterprise-php-1227605806710884-9Phpworks enterprise-php-1227605806710884-9
Phpworks enterprise-php-1227605806710884-9
 
Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017
 
Build Your First EE2 Site
Build Your First EE2 SiteBuild Your First EE2 Site
Build Your First EE2 Site
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of Chef
 
Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...
Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...
Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...
 
OpenShift with Eclipse Tooling - EclipseCon 2012
OpenShift with Eclipse Tooling - EclipseCon 2012OpenShift with Eclipse Tooling - EclipseCon 2012
OpenShift with Eclipse Tooling - EclipseCon 2012
 
Tool up your lamp stack
Tool up your lamp stackTool up your lamp stack
Tool up your lamp stack
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP Stack
 
Invoke-Obfuscation DerbyCon 2016
Invoke-Obfuscation DerbyCon 2016Invoke-Obfuscation DerbyCon 2016
Invoke-Obfuscation DerbyCon 2016
 
Extracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails AppsExtracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails Apps
 
Cypress report
Cypress reportCypress report
Cypress report
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
Automation with OS X
Automation with OS XAutomation with OS X
Automation with OS X
 
OSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsOSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy Hawkins
 
Refactoring Legacy Code - true story
Refactoring Legacy Code - true storyRefactoring Legacy Code - true story
Refactoring Legacy Code - true story
 

Kürzlich hochgeladen

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Kürzlich hochgeladen (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 

A walk through system layers