In order to create a good
software, you have to know
what the software is all
about.
– Eric Evans
Slide 11
Slide 11 text
How do we learn?
Slide 12
Slide 12 text
Stakeholders
Slide 13
Slide 13 text
Ask for examples...
...write stories!
Slide 14
Slide 14 text
Vocabulary
Slide 15
Slide 15 text
Ubiquitous Language
Ubiquitous
Language
Slide 16
Slide 16 text
Ubiquitous Language
Ubiquitous
Language
Domain
Expert
Analyst
Tester Developer
Developer
Slide 17
Slide 17 text
Ubiquitous Language
Ubiquitous
Language
Domain
Expert
Analyst
Tester Developer
Developer
Application
Code Acceptance
Criteria
Specs and
documentation
Slide 18
Slide 18 text
Example?
Slide 19
Slide 19 text
Example
Slide 20
Slide 20 text
Example
Slide 21
Slide 21 text
Domain
Slide 22
Slide 22 text
Implementation
Slide 23
Slide 23 text
why interface?
Slide 24
Slide 24 text
Layered Architecture
“High level modules
should not depend on
lower level
implementation”
– Robert C. Martin
User Interface
Application
Domain
Infrastructure
Slide 25
Slide 25 text
Dependency Inversion
Policy Layer
Policy Service
Mechanism
Layer
Mechanism
Service
Utility Layer
Slide 26
Slide 26 text
Layered Architecture
User Interface
Application
Domain
Infrastructure
Slide 27
Slide 27 text
Layered Architecture
User Interface
Application
Domain
Infrastructure
Slide 28
Slide 28 text
Clean Architecture
Entities
Use Cases
Controllers
Web
Slide 29
Slide 29 text
Clean Architecture
Entities
Use Cases
Controllers
Web
Framework
Drivers
Interface
Adapters
Application
Business
Rules
Enterprise
Business
Rules
Slide 30
Slide 30 text
Hexagonal Architecture
UI Adapter
Log Adapter
Data Storage
Adapter
External Data
Adapter
Application
Domain
Hexagonal Architecture
Acme\Depot\DepotLocator
Acme\MagentoAdapter\MagentoDepotLocator
port
adapter
Slide 33
Slide 33 text
Why clean architecture?
Slide 34
Slide 34 text
Why clean architecture?
- your code is clean(er)
Slide 35
Slide 35 text
Why clean architecture?
- your code is clean(er)
- decoupled from framework
Slide 36
Slide 36 text
Why clean architecture?
- your code is clean(er)
- decoupled from framework
- reusable
Slide 37
Slide 37 text
Why clean architecture?
- your code is clean(er)
- decoupled from framework
- reusable
- easy to test
Slide 38
Slide 38 text
Why clean architecture?
- your code is clean(er)
- decoupled from framework
- reusable
- easy to test
- easy to maintain
Slide 39
Slide 39 text
Why clean architecture?
- your code is clean(er)
- decoupled from framework
- reusable
- easy to test
- easy to maintain
- easy to change
Slide 40
Slide 40 text
No content
Slide 41
Slide 41 text
No content
Slide 42
Slide 42 text
dependency injection
Slide 43
Slide 43 text
Dependency Injection
- a standardised and centralised way of
constructing objects in our application
Slide 44
Slide 44 text
Kernel
Slide 45
Slide 45 text
Kernel
Slide 46
Slide 46 text
Kernel
Slide 47
Slide 47 text
Kernel
Slide 48
Slide 48 text
Kernel
Slide 49
Slide 49 text
Kernel
Slide 50
Slide 50 text
Kernel
Slide 51
Slide 51 text
parameters.yml
Slide 52
Slide 52 text
services.xml
Slide 53
Slide 53 text
console commands
Slide 54
Slide 54 text
Import Handler
Slide 55
Slide 55 text
Console command
Slide 56
Slide 56 text
app/console
Slide 57
Slide 57 text
persisting products
Slide 58
Slide 58 text
XML Writer
Slide 59
Slide 59 text
Why write XML?
- fetching data from Magento and dumping
it into xml file is quick
- xml can be imported by Drupal’s feed
importer
Slide 60
Slide 60 text
Why it didn’t work?
- Feed importer was damn slow
- 10k products imported in 4.5h
- Scheduling import with Elysia Cron
module was flaky
- Scheduled feed importer would add
products all over again
- resources hungry!
Slide 61
Slide 61 text
Direct save to the db
Slide 62
Slide 62 text
Why direct save to the db?
- Drupal promises data structure won’t ever
change
- It’s fast - 40k products in 2 minutes
- It works!