Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

A walk through system layers

3,615 views

Published on

https://github.com/norzechowicz/mydrinks

Published in: Software
  • Dating direct: ❤❤❤ http://bit.ly/2Q98JRS ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ❤❤❤ http://bit.ly/2Q98JRS ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

A walk through system layers

  1. 1. Albert Einstein Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. „
  2. 2. Test Driven
 Development Behavior Driven Development Domain Driven
 Design
  3. 3. Test Driven
 Development Behavior Driven Development Domain Driven
 Design
  4. 4. Don’t think about that now
  5. 5. Architecture
  6. 6. Inspired by Shrek (and drugs ;) Ogres and Applications are like onions
  7. 7. • Domain • Application • Infrastructure • User Interface They both have layers!
  8. 8. A long time ago in a bar far, far away…
  9. 9. It is all about Recipe
  10. 10. Let’s make an App
 for that
  11. 11. but… explore the domain first!
  12. 12. 48 hours later…
  13. 13. Version 1.0 features • recipes search engine • recipe drink photos • ingredients list • possibility to add new recipes (admin only) • comments • social media stufff
  14. 14. Domain 1
  15. 15. Examples
  16. 16. 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
  17. 17. /** * @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
  18. 18. Im not sure but something is wrong here
  19. 19. Let’s try with SPECS
  20. 20. 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();
  21. 21. 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();
  22. 22. IngredientSpec.php CapacitySpec.php AmountSpec.php RecipeDescriptionSpec.php Other SPECS
  23. 23. • Value Objects • Entities • Services • Aggregates
  24. 24. 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 |
  25. 25. Make it Unbreakable
  26. 26. Domain (model)
  27. 27. 2 Application
  28. 28. Think like a programmer
  29. 29. Talk to me
  30. 30. • CreateNewRecipeCommand.php • AddRecipeStepCommand.php • RemoveRecipeStepCommand.php • UpdateRecipeDescriptionCommand.php • UploadRecipePhotoCommand.php • PublishRecipeCommand.php
  31. 31. • Create New Recipe • Add Recipe Step • Remove Recipe Step • Update Recipe Description • Upload Recipe Photo • Publish Recipe
  32. 32. • CreateNewRecipeCommand.php • AddRecipeStepCommand.php • RemoveRecipeStepCommand.php • UpdateRecipeDescriptionCommand.php • UploadRecipePhotoCommand.php • PublishRecipeCommand.php
  33. 33. • Search Engine • Autocomplete (Ingredients) • Recipes Collection (Repository) Well, sometimes you have to ask…?
  34. 34. • Command Bus • Command Handlers • Recipe Serializer Other things • Filesystem • SlugGenerator
  35. 35. <?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; } }
  36. 36. Immutable commands
  37. 37. <?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); } }
  38. 38. Wait a minute…
  39. 39. <?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); }
  40. 40. Well done!
  41. 41. Application
  42. 42. 3 Infrastructure
  43. 43. Just implement interfaces
  44. 44. • FlySystemFilesystem • InMemoryRepository • FilesystemRepository • SlugifySlugGenerator • JsonSerializer • ElasticSearchEngineAdapter • DummySearchEngineAdapter
  45. 45. Interface
  46. 46. LEGO Power Functions - Engine Implementation
  47. 47. Literally nothing for testing purpose only Dummy 
 implementation
  48. 48. 4 User Interface
  49. 49. Connection between user and application
  50. 50. Framework based
  51. 51. • ROUTING • TEMPLATING ENGINE • SERVICE LOCATOR • FORMS • VALIDATION • REQUEST RESPONSE WRAPPERS
  52. 52. Symfony 2
  53. 53. Laravel

  54. 54. Zend 2
  55. 55. Hybride?
  56. 56. Symfony 2 + Laravel? Maybe with shared service locator
  57. 57. • WEB APPLICATION • CONSOLE APPLICATION • REST API • SOAP API • GUI Examples
  58. 58. User Interface
  59. 59. 5 System
  60. 60. DOMAIN APPLICATION USER INTERFACE I N F R A S T R U C T U R E
  61. 61. System
  62. 62. My Drinks v 1.0 160 working hours 1 developer
  63. 63. A walk through system layers Story written by alcohol
  64. 64. http://twitter.com/norzechowicz
 http://github.com/norzechowicz
 norbert@orzechowicz.pl
 http://phpers.pl Norbert Orzechowicz
  65. 65. https://github.com/norzechowicz/mydrinks My Drinks Repository
  66. 66. http://zawarstwaabstrakcji.pl
  67. 67. Questions?

×