DPC15 uncon talk: How cyborg puppies can sniff out code smell
-
Upload
goatcode -
Category
Presentations & Public Speaking
-
view
53 -
download
0
Transcript of DPC15 uncon talk: How cyborg puppies can sniff out code smell
- 1. How cyborg puppies can sniff out code smell Niels van Esch @goatcode https://joind.in/14706
- 2. OOP 101
- 3. class Dog { public function bark() { echo woof; } }
- 4. class Chihuahua extends Dog { public function bark() { echo kef-kef; } }
- 5. class GermanShepherd extends Dog { public function bark() { echo ACHTUNG!; } }
- 6. Abstract class Dog { public function bark() { echo woof; } public function wagTail() { echo woosh!; } }
- 7. class Tail { public function wag() { echo woosh; } }
- 8. class Dog { private $tail; ... public function wagTail() { if($this->tail === null) { $this->tail = new Tail(); } $this->tail->wag(); } }
- 9. Command pattern $command->execute();
- 10. Command handler $handler->handle($command);
- 11. Command bus $commandBus->handle($command);
- 12. More real examples using furniture to check Single responsibility principle Open/closed principle Liskov substitution principle Interface segregation principle Dependency inversion principle
- 13. Questions? Niels van Esch [email protected] @goatcode https://joind.in/14706