SlideShare a Scribd company logo
Luís Cobucci

@lcobucci
fix your architecture!
Enough suffering,
Inexperience and
lack of discipline
Huge number of
developers
Bugs and defects
“ does it
have to be
hard ?Frederik Brooks
No Silver Bullet - 1986
Luís Cobucci

@lcobucci
Complexity
Complexity
essential accidental
“ I need a scalable
API that stores and
retrieves the medical
history of patients in
order to help doctors
create an accurate
diagnosis
The client
“ I need a scalable
API that stores and
retrieves the medical
history of patients in
order to help doctors
create an accurate
diagnosis
The client
“ I need a scalable
API that stores and
retrieves the medical
history of patients in
order to help doctors
create an accurate
diagnosis
The client
There is no
Silver Bullet
Frameworks
“ Woe is the architect
who prematurely
decides on a database,
and then finds that flat
files would have been
sufficient.
Robert C. Martin
The PERFECT
Architecture
BCE
DCI
Onion
architecture
Hexagonal
architecture
Clean
architecture
“ To communicate
effectively, the code must be
based on the same language
used to write the
requirements — the same
language that the developers
speak with each other and
with domain experts.
Eric Evans
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
How does it work?
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
Request
model
USER INTERFACE
APPLICATION
DOMAIN
INFRA
Request
model
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
USER INTERFACE
APPLICATION
DOMAIN
INFRA
Response
model
USER INTERFACE
APPLICATION
DOMAIN
INFRA
Response
model
USER INTERFACE
APPLICATION
DOMAIN
INFRA
HTML/JSON/*
How to start?
Command Query
Separation
function createBook(

Isbn $isbn,

Author $author,

string $title

): Book {

$book = new Book($isbn, $author, $title);



$this->collection->add($book);



return $book;

}
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->collection->add(

new Book($isbn, $author, $title)

);

}



function findBook(Isbn $isbn): ?Book

{

return $this->collection->find($isbn);

}
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->collection->add(

new Book($isbn, $author, $title)

);

}



function findBook(Isbn $isbn): ?Book

{

return $this->collection->find($isbn);

}
Command

method
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->collection->add(

new Book($isbn, $author, $title)

);

}



function findBook(Isbn $isbn): ?Book

{

return $this->collection->find($isbn);

}
Command

method
Query

method
Command Query
Responsibility Segregation
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->library->add(

new Book($isbn, $author, $title)

);

}



function findBook(Isbn $isbn): ?BookModel

{

return $this->inventory->find($isbn);

}
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->library->add(

new Book($isbn, $author, $title)

);

}



function findBook(Isbn $isbn): ?BookModel

{

return $this->inventory->find($isbn);

}
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->library->add(

new Book($isbn, $author, $title)

);

}



function findBook(Isbn $isbn): ?BookModel

{

return $this->inventory->find($isbn);

}
Service bus
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->library->add(

new Book($isbn, $author, $title)

);

}
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->library->add(

new Book($isbn, $author, $title)

);

}
Intent
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->library->add(

new Book($isbn, $author, $title)

);

}
Intent
Data
function createBook(

Isbn $isbn,

Author $author,

string $title

): void {

$this->library->add(

new Book($isbn, $author, $title)

);

}
Intent
Data
Processing
Intent + Data = Message
class CreateBook

{

private $isbn, $author, $title;


public function isbn(): Isbn {}
public function authorId(): AuthorId {}
public function title(): string {}

}
function handle(CreateBook $message): void

{

$this->library->add(

new Book(

$message->isbn(),

$this->authors->get($message->authorId()),

$message->title()

)

);

}
function handle(CreateBook $message): void

{

$this->library->add(

new Book(

$message->isbn(),

$this->authors->get($message->authorId()),

$message->title()

)

);

}
Message
function handle(CreateBook $message): void

{

$this->library->add(

new Book(

$message->isbn(),

$this->authors->get($message->authorId()),

$message->title()

)

);

}
Message
Processing
$serviceBus->handle(

new CreateBook($isbn, $authorId, $title)

);
Event sourcing
Collaboration
“ One of our difficulties
will be the maintenance of
an appropriate discipline, so
that we do not lose track of
what we are doing
Alan Turing 1945
Luís Cobucci

@lcobucci
fix your architecture!
Enough suffering,
Thanks!
@lcobucci

More Related Content

PDF
PHP and Rich Internet Applications
PDF
Putting the Cat in the Catalogue: A Feline-Inspired OPAC Theme For Koha
PDF
Jquery, write less do more by weLaika
PDF
PHP and Rich Internet Applications
PPTX
Anonymous classes
PPT
Awash in a sea of connections
PDF
State of the Sass - The Mixin (November 2016)
PHP and Rich Internet Applications
Putting the Cat in the Catalogue: A Feline-Inspired OPAC Theme For Koha
Jquery, write less do more by weLaika
PHP and Rich Internet Applications
Anonymous classes
Awash in a sea of connections
State of the Sass - The Mixin (November 2016)

Viewers also liked (20)

PDF
JWT - To authentication and beyond!
PDF
Como criar melhores times de desenvolvimento - TDC POA 2016
PDF
Devs. Aonde estão? Aqui estão!
PDF
Introdução a worker 2.0
PDF
Além do MVP com PHP - TDC Floripa 2016
PDF
Functional programming with php7
PDF
Create, test, secure, repeat
PPTX
Engineer - Mastering the Art of Software
PDF
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
PDF
Hack the Future
PDF
Zend Framework Foundations
PDF
php[world] 2015 Training - Laravel from the Ground Up
PDF
Amp your site an intro to accelerated mobile pages
PDF
Git Empowered
PDF
Console Apps: php artisan forthe:win
PDF
Dip Your Toes in the Sea of Security
PDF
Code Coverage for Total Security in Application Migrations
PDF
Presentation Bulgaria PHP
PPTX
Php extensions
PDF
SunshinePHP 2017 - Making the most out of MySQL
JWT - To authentication and beyond!
Como criar melhores times de desenvolvimento - TDC POA 2016
Devs. Aonde estão? Aqui estão!
Introdução a worker 2.0
Além do MVP com PHP - TDC Floripa 2016
Functional programming with php7
Create, test, secure, repeat
Engineer - Mastering the Art of Software
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
Hack the Future
Zend Framework Foundations
php[world] 2015 Training - Laravel from the Ground Up
Amp your site an intro to accelerated mobile pages
Git Empowered
Console Apps: php artisan forthe:win
Dip Your Toes in the Sea of Security
Code Coverage for Total Security in Application Migrations
Presentation Bulgaria PHP
Php extensions
SunshinePHP 2017 - Making the most out of MySQL
Ad

Similar to Enough suffering, fix your architecture! (20)

PPT
Php introduction
PDF
MVS: An angular MVC
KEY
Rails vu d'un Javaiste
PPTX
Doing Joins in MongoDB: Best Practices for Using $lookup
PDF
DBIx::Class introduction - 2010
KEY
LibreCat::Catmandu
PDF
MongoDB Aggregation Framework
PDF
Mvc - Model: the great forgotten
PPTX
Database Programming
PPTX
Text to data
PDF
Arquitetando seu app Android com Jetpack
PDF
A piece of sugar in your client-side development
PPTX
BIBFRAME and OCLC Works: Defining Models and Discovering Evidence
PDF
DBIx::Class beginners
PDF
CouchDB at JAOO Århus 2009
PDF
Introduction to MongoDB
PPTX
Webinar: Building Your First Application with MongoDB
PDF
Build REST API clients for AngularJS
PDF
Introduction to CouchDB
PDF
Beyond MVC: from Model to Domain
Php introduction
MVS: An angular MVC
Rails vu d'un Javaiste
Doing Joins in MongoDB: Best Practices for Using $lookup
DBIx::Class introduction - 2010
LibreCat::Catmandu
MongoDB Aggregation Framework
Mvc - Model: the great forgotten
Database Programming
Text to data
Arquitetando seu app Android com Jetpack
A piece of sugar in your client-side development
BIBFRAME and OCLC Works: Defining Models and Discovering Evidence
DBIx::Class beginners
CouchDB at JAOO Århus 2009
Introduction to MongoDB
Webinar: Building Your First Application with MongoDB
Build REST API clients for AngularJS
Introduction to CouchDB
Beyond MVC: from Model to Domain
Ad

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
medical staffing services at VALiNTRY
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Odoo Companies in India – Driving Business Transformation.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
medical staffing services at VALiNTRY
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Why Generative AI is the Future of Content, Code & Creativity?
Internet Downloader Manager (IDM) Crack 6.42 Build 41
CHAPTER 2 - PM Management and IT Context
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
wealthsignaloriginal-com-DS-text-... (1).pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Digital Systems & Binary Numbers (comprehensive )
Softaken Excel to vCard Converter Software.pdf
L1 - Introduction to python Backend.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems

Enough suffering, fix your architecture!