29. Simple vs Easy
$mysqli = new mysqli("localhost", "horus", "olakease", “suite");
$mysqli->query("INSERT INTO users …”))
SIMPLE
EASY
/**
* @ORMEntity
* @ORMTable(name="product")
*/
class Product
30. $sum = function ($carry, $item) { return $carry + $item; }
array_reduce([1, 2, 3], $sum);
$acc = 0;
foreach ([1, 2, 3] as $value) {
$acc += $value;
}
SIMPLE
EASY
Simple vs EasySimple vs Easy
31. $acc = 0;
foreach ([1, 2, 3] as $value) {
$acc += $value;
}
SIMPLE
EASY
(reduce + [1 2 3])
Simple vs EasySimple vs Easy
32. Simplicity vs Easiness
• Easy to understand
• Easy to debug
• Easy to change,
flexibility,
maintenable
• Easy to use
• Hard to debug
• Hard to change
33. Complected
• Something does more than one thing and you can’t
split it easily
• Source of accidental complexity
• DON’T DO IT
43. Trust
Great teams are unafraid to air their dirty laundry, admit
their mistakes, their weaknesses and their concerns
without fear.
Patrick Lencioni
75. Mistakes
• Do not store domain events
• Own libraries for CQRS & DDD
• Do not use Domain Services
• Domain events with wrong identifiers
• Couple App Services to Commands & Queries
• Not start earlier some Modules/Bounded Contexts
77. Problems
• Domain Events: Lost of order (async)
• Doctrine
• Unit Of Work + Integration Test = Fail
• Embedded: Identifier or not
• Behat: The Container
78. Tips & Tricks
• Repositories:
• Just add, save and find
• Use of DQL implies the schema is too complex
• Controllers: 50 lines of code
• Application Services: Avoid business logic
• One step at time: Hex. Arch. -> DDD -> CQRS -> ES?
• Start it as a Module and promote it later to BC