SlideShare a Scribd company logo
1 of 50
Download to read offline
From framework coupled code to
microservices through DDD modules
MVC, Testing, SOLID, Domain-Driven Design, Microservices
@CodelyTV
@Rafaoe

@JavierCane#NubeloMeetup - IronHack 25/10/2016
Venue
Org
Beers
Contents
Welcome!
@Rafaoe @JavierCane
Contents
gOld days The holy grail
of testing
Bigger &
faster
MVC frameworks
to the rescue
Serious
business Recap
Thanks!
@TangeloEng
@UvinumEng@Thatzad
1.

gOLD days
<?php

/**

* The template for displaying all single posts
and attachments

*

* @package WordPress

* @subpackage Twenty_Sixteen

* @since Twenty Sixteen 1.0

*/



get_header(); ?>



<div id="primary" class="content-area">

<main id="main" class="site-main"
role="main">

<?php

// Start the loop.

while (have_posts()) : the_post();

single.php
role="main">

<?php

// Start the loop.

while (have_posts()) : the_post();



// Include the single post
content template.

get_template_part('template-
parts/content', 'single');



// If comments are open or we
have at least one comment, load up the comment
template.

if (comments_open() ||
get_comments_number()) {

comments_template();

}



if (is_singular('attachment')) {

single.php
) . '</span> ' .
'<span class="post-title">%title</span>',

]

);

}



// End of the loop.

endwhile;

?>



</main><!-- .site-main -->



<?php get_sidebar('content-bottom'); ?>



</div><!-- .content-area -->



<?php get_sidebar(); ?>

<?php get_footer(); ?>

single.php
! Scripts
◕ index.php
◕ utils.php
◕ helpers.php
◕ include & require_once
The Concept
gOld days
! Have to learn
◕ Mindset
◕ Toolset
◗ PHP – Namespaces y autoloader Composer
◗ PHP – Estilo de código, estándar PSR 2
◗ Generación automática de código con IntelliJ y PhpStorm
◕ Domain
◗ Incomprehensible Finder Kata Refactoring
! All is The Concept
The Concept
gOld days
ºº
2.

MVC frameworks to the rescue
<?php



class ctrl_frontend extends Controller {



function ctrl_frontend()

{

parent::Controller(); 

if (!isset($_SESSION)) {

session_start();

}

}



function index()

{

$this->load-
>model('sobre_nosotros','',TRUE);



THE Controller
$datos['sobreNosotros']=$this-
>sobre_nosotros->getApartados();



$this->load->view('quienes',
$datos);

break;

case 'portfolio': 

$this->load-
>model('proyecto','',TRUE);

$this->load-
>model('seguimiento_proyecto','',TRUE);



$retorno = $this->proyecto-
>getProyectosPortfolio(); //primero obtengo los
datos de los proyectos



if($retorno!=null){ //si hay
proyectps

THE Controller
$datos);

}



private function sesionIniciada(){

$this->load->helper('url');

redirect('ctrl_backend_admin/
proyectoListar','refresh');

}



private function error($msg){

$data["tipoError"]=$msg; 

$this->load->view('error',$data);

}

}



/* End of file welcome.php */

/* Location: ./system/application/controllers/
welcome.php */

THE Controller
! Wins
◕ Controller per concept
◕ Isolate views & DB
◕ Active Record discovery
! New
◕ Singletons, singletons everywhere
◕ “Models” & other misconceptions
◕ DB structure defined by ORM
! Still
◕ Highly coupled code
◕ “Software Architecture is for UML people”
The Concept
MVC frameworks to the rescue
! Internal doubts
◕ Por qué NO usar getters y setters | Tell don’t ask
◕ Por qué programar sin usar “else” – Cláusulas de guarda
◕ Varios returns en una función: ¿Mal o bien?
◕ Qué son los Code Smells y el Refactoring
◕ Constructores semánticos – Named constructors
The Concept
MVC frameworks to the rescue
class CourseController extends FOSRestController

{

public function getCourseAction(Request $request)

{

return $this->getDoctrine()

->getEntityManager()

->createQueryBuilder()

->select('c', 'v')

->from('AppBundleModelCourse', 'c')

->where('c.level', '>', $request-
>get('from_level', 0))

->getQuery()

->execute();

}



public function getCourseVideosAction($courseId)

{

return $this->getDoctrine()

Course controller
bit.ly/codelytv-course-ctrl-fw
class Course extends CourseBaseModel

{

public $title;

public $level;



/**

* @return mixed

*/

public function getTitle()

{

return $this->title;

}



/**

* @param mixed $title

*/

public function setTitle($title)

{

$this->title = $title;

Course model
bit.ly/codelytv-course-model-anemic
3.

The holy grail of testing
! Wins
◕ If you don’t test, you’re going to suffer
◕ SOLID at a micro-design scale
! New
◕ Fragile test due to coupled code bases
◕ Test private methods or not?
! Still
◕ Controller per concept
◕ “Models”, singletons & laravel “facades”
The Concept
The holy grail of testing
class CourseControllerTest extends
PHPUnit_Framework_TestCase

{

public function testGetCoursesFilteredByLevel()

{

$fromLevel = 0;

$request = new Request(['from_level' =>
$fromLevel]);



$container =
Mockery::mock(ContainerInterface::class);

$doctrine =
Mockery::mock(Registry::class);

$entityManager =
Mockery::mock(EntityManager::class);

$queryBuilder =
Mockery::mock(QueryBuilder::class);

$query =
Course controller test


$controller = new CourseController();

$controller->setContainer($container);

$controllerResult = $controller-
>getCourseAction($request);

$this->assertEquals(

[

[

'title' => 'Codely mola',

'level' => 2,

],

[

'title' => 'Aprende a decir
basicamente como Javi',

'level' => 5,

],

],

$controllerResult

);

}

}
Course controller test
bit.ly/codelytv-course-ctrl-fw-test
! Testing help
◕ Cómo testear código acoplado: Costuras
◕ ¿Puedes ayudarte del #TDD para diseñar software? – Diseños
emergentes
◕ Cómo escuchar a tus test #NaveMisterioCodelyTV
◕ Por qué no usar static
! SOLID
◕ Principio de Responsabilidad Única SRP
◕ Principio de Segregación de Interfaces ISP
◕ Errores comunes al diseñar Interfaces
◕ Principio de Inversión de Dependencias DIP
The Concept
The holy grail of testing
4.

Serious business
! Wins
◕ Decoupling business logic from framework
◕ Module per concept
◕ Semantics and clean code as something necessary
◕ Ease testing
◕ SOLID at a macro-design scale
◕ DB structure defined by domain
! New
◕ Unlearning process
◕ Deep research aptitude
◕ Theory misinterpretations
The Concept
Serious business
The growth stages of a programmer
1st stage 2nd stage 3rd stage
Knowledge Code complexity
Non scientific source :P : https://www.youtube.com/watch?v=2qYll837a_0


final class VideoController extends Controller

{

private $bus;



public function __construct(CommandBus $bus)

{

$this->bus = $bus;

}



public function createAction(

string $id,

Request $request

) {

$command = new CreateVideoCommand(

$id,

$request->get('title'),

$request->get('url'),

$request->get('course_id')

Video controller
{

$this->bus = $bus;

}



public function createAction(

string $id,

Request $request

) {

$command = new CreateVideoCommand(

$id,

$request->get('title'),

$request->get('url'),

$request->get('course_id')

);



$this->bus->dispatch($command);



return new HttpCreatedResponse();

}

}

Video controller
bit.ly/codelytv-video-ctrl
final class CreateVideoCommandHandler implements Command

{

private $creator;



public function __construct(VideoCreator $creator)

{

$this->creator = $creator;

}



public function __invoke(CreateVideoCommand $command)

{

$id = new VideoId($command->id());

$title = new VideoTitle($command->title());

$url = new VideoUrl($command->url());

$courseId = new CourseId($command->courseId());



$this->creator->create(
$id,
$title,
$url,
$courseId
Create video command handler
bit.ly/codelytv-video-handler
final class VideoCreator

{

private $repository;

private $publisher;



public function __construct(

VideoRepository $repository,

DomainEventPublisher $publisher

) {

$this->repository = $repository;

$this->publisher = $publisher;

}



public function create(

VideoId $id,

VideoTitle $title,

VideoUrl $url,

CourseId $courseId

Video creator application service
DomainEventPublisher $publisher

) {

$this->repository = $repository;

$this->publisher = $publisher;

}



public function create(

VideoId $id,

VideoTitle $title,

VideoUrl $url,

CourseId $courseId

) {

$video =
Video::create($id, $title, $url, $courseId);



$this->repository->save($video);



$this->publisher->publish(
$video->pullDomainEvents()
);

}

Video creator application service
bit.ly/codelytv-video-as
final class Video extends AggregateRoot

{

private $id;

private $title;

private $url;

private $courseId;



public function __construct(

VideoId $id,

VideoTitle $title,

VideoUrl $url,

CourseId $courseId

)

{

$this->id = $id;

$this->title = $title;

Video domain model
$this->courseId = $courseId;

}



public static function create(

VideoId $id,

VideoTitle $title,

VideoUrl $url,

CourseId $courseId

)

{

$video =
new self($id, $title, $url, $courseId);



$video->record(
new VideoCreatedDomainEvent($id)
);



return $video;

}

Video domain model
bit.ly/codelytv-video-model
final class CreateVideoTest extends VideoModuleUnitTestCase

{

/** @var CreateVideoCommandHandler */

private $handler;



protected function setUp()

{

parent::setUp();



$creator = new VideoCreator(

$this->repository(),

$this->domainEventPublisher()

);



$this->handler =
new CreateVideoCommandHandler($creator);

}



/** @test */

Create video test
public function it_should_create_a_video()

{

$command = CreateVideoCommandStub::random();



$video = VideoStub::fromRawValues(

$command->id(),

$command->title(),

$command->url(),

$command->courseId()

);



$event = VideoCreatedDomainEventStub::fromRawValues(

$command->id(),

$command->title(),

$command->url(),

$command->courseId()

);



$this->shouldSaveVideo($video);

$this->shouldPublishDomainEvents([$event]);



$this->dispatch($command, $this->handler);

Create video test
bit.ly/codelytv-video-test
! Tips / knowledge we’d like to have had
◕ Caso real de replanteamiento de diseño de Software
◕ Explicar Refactorings de forma didáctica – QWAN Cards
◕ Introducción Arquitectura Hexagonal – DDD
The Concept
Serious business
5.

Bigger & faster
! Wins:
◕ (SOLID + Software Architecture theory + Testing)
accomplished
◕ Bounded context (even microservices) per concept
◕ More teams
! New:
◕ Accidental complexity (infrastructure, coordination…)
The Concept
Bigger & faster
6.

Recap
! There’s no silver bullet approach. All depends on the context, and the
context will evolve.
! Conclusion: The Concept must be easy to promote with context evolutions
◕ From framework to modules:
◗ Decouple from outside infrastructure in order to isolate the domain
◗ Isolate use cases and work on cohesion
◕ From modules to Bounded Context:
◗ Decouple using buses to interact between them
◕ From whatever to Microservices:
◗ You don’t have to promote anything. This is not a change in terms
source code but in terms of infrastructure
The Concept
Recap
Tabla molona
Framework
coupled code
Modules
Bounded
Contexts
Microservices
Learning curve Low Medium High High++
Teams autonomy Low Medium+ High High++
Infrastructure
Shared (&
coupled)
Shared Individual
Individual &
distributed
Code
maintainability/
extensibility
Low— High High+ High++
Infrastructure
complexity
Low Medium Medium High++++
Communication
between them
Coupled Buses Buses Distributed buses
Deploy Shared Shared Shared Isolated
We’re not promoting microservices per se. Due to infrastructure and accidental complexity It could be the worst option actually.
Takeaways
Takeaways
! Unit Testing sucks (and it’s our fault) - José Armesto
! Vídeos sobre SOLID - CodelyTV
! Hexagonal Architecture - Chris Fidao
! Introducción Arquitectura Hexagonal – DDD - CodelyTV
! Domain-Driven Design in PHP - Carlos Buenosvinos, Christian Soronellas
and Keyvan Akbary
! A wave of command buses - Matthias Noback
! How to Avoid Building a Distributed Monolith - Felipe Dornelas
! PHP Barcelona Monthly Talk: DDD Applied & Symfony MPWAR Edition -
Sergi González & Eloi Poch
! Implementing Domain-Driven Design - Vaughn Vernon
! This talk repositories (to be published on github.com/CodelyTV)
Questions?
Thanks!
Contact
@JavierCane
@CodelyTV
@Rafaoe

More Related Content

What's hot

Clean Architecture
Clean ArchitectureClean Architecture
Clean ArchitectureBadoo
 
PHPの今とこれから2020
PHPの今とこれから2020PHPの今とこれから2020
PHPの今とこれから2020Rui Hirokawa
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and DjangoMichael Pirnat
 
Dependency injection presentation
Dependency injection presentationDependency injection presentation
Dependency injection presentationAhasanul Kalam Akib
 
The Beginner’s Guide To Spring Cloud
The Beginner’s Guide To Spring CloudThe Beginner’s Guide To Spring Cloud
The Beginner’s Guide To Spring CloudVMware Tanzu
 
Asynchronous javascript
 Asynchronous javascript Asynchronous javascript
Asynchronous javascriptEman Mohamed
 
Towards Functional Programming through Hexagonal Architecture
Towards Functional Programming through Hexagonal ArchitectureTowards Functional Programming through Hexagonal Architecture
Towards Functional Programming through Hexagonal ArchitectureCodelyTV
 
L'API Collector dans tous ses états
L'API Collector dans tous ses étatsL'API Collector dans tous ses états
L'API Collector dans tous ses étatsJosé Paumard
 
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...Edureka!
 
Introduction to SOLID Principles
Introduction to SOLID PrinciplesIntroduction to SOLID Principles
Introduction to SOLID PrinciplesGanesh Samarthyam
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring BootTrey Howard
 

What's hot (20)

Vue 2 vs Vue 3.pptx
Vue 2 vs Vue 3.pptxVue 2 vs Vue 3.pptx
Vue 2 vs Vue 3.pptx
 
Angular
AngularAngular
Angular
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
API for Beginners
API for BeginnersAPI for Beginners
API for Beginners
 
PHPの今とこれから2020
PHPの今とこれから2020PHPの今とこれから2020
PHPの今とこれから2020
 
Modern JS with ES6
Modern JS with ES6Modern JS with ES6
Modern JS with ES6
 
Spring Core
Spring CoreSpring Core
Spring Core
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Dependency injection presentation
Dependency injection presentationDependency injection presentation
Dependency injection presentation
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
The Beginner’s Guide To Spring Cloud
The Beginner’s Guide To Spring CloudThe Beginner’s Guide To Spring Cloud
The Beginner’s Guide To Spring Cloud
 
Asynchronous javascript
 Asynchronous javascript Asynchronous javascript
Asynchronous javascript
 
Spring boot
Spring bootSpring boot
Spring boot
 
Towards Functional Programming through Hexagonal Architecture
Towards Functional Programming through Hexagonal ArchitectureTowards Functional Programming through Hexagonal Architecture
Towards Functional Programming through Hexagonal Architecture
 
L'API Collector dans tous ses états
L'API Collector dans tous ses étatsL'API Collector dans tous ses états
L'API Collector dans tous ses états
 
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...
 
Introduction to SOLID Principles
Introduction to SOLID PrinciplesIntroduction to SOLID Principles
Introduction to SOLID Principles
 
Design patterns in PHP
Design patterns in PHPDesign patterns in PHP
Design patterns in PHP
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 

Viewers also liked

Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDAleix Vergés
 
When cqrs meets event sourcing
When cqrs meets event sourcingWhen cqrs meets event sourcing
When cqrs meets event sourcingManel Sellés
 
Microservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, DDD, and KubernetesMicroservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, DDD, and KubernetesChristian Posta
 
Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)Rob Crowley
 
Designing APIs and Microservices Using Domain-Driven Design
Designing APIs and Microservices Using Domain-Driven DesignDesigning APIs and Microservices Using Domain-Driven Design
Designing APIs and Microservices Using Domain-Driven DesignLaunchAny
 
Architecting Microservices in .Net
Architecting Microservices in .NetArchitecting Microservices in .Net
Architecting Microservices in .NetRichard Banks
 
Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...
Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...
Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...Lightbend
 
Scala/Scrum/DDD 困ったこと50連発ガトリングトーク!!
Scala/Scrum/DDD 困ったこと50連発ガトリングトーク!!Scala/Scrum/DDD 困ったこと50連発ガトリングトーク!!
Scala/Scrum/DDD 困ったこと50連発ガトリングトーク!!Yasuyuki Sugitani
 
RDRA DDD Agile
RDRA DDD AgileRDRA DDD Agile
RDRA DDD Agile増田 亨
 

Viewers also liked (9)

Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
 
When cqrs meets event sourcing
When cqrs meets event sourcingWhen cqrs meets event sourcing
When cqrs meets event sourcing
 
Microservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, DDD, and KubernetesMicroservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, DDD, and Kubernetes
 
Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)
 
Designing APIs and Microservices Using Domain-Driven Design
Designing APIs and Microservices Using Domain-Driven DesignDesigning APIs and Microservices Using Domain-Driven Design
Designing APIs and Microservices Using Domain-Driven Design
 
Architecting Microservices in .Net
Architecting Microservices in .NetArchitecting Microservices in .Net
Architecting Microservices in .Net
 
Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...
Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...
Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...
 
Scala/Scrum/DDD 困ったこと50連発ガトリングトーク!!
Scala/Scrum/DDD 困ったこと50連発ガトリングトーク!!Scala/Scrum/DDD 困ったこと50連発ガトリングトーク!!
Scala/Scrum/DDD 困ったこと50連発ガトリングトーク!!
 
RDRA DDD Agile
RDRA DDD AgileRDRA DDD Agile
RDRA DDD Agile
 

Similar to From framework coupled code to microservices through DDD modules

Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
Mykhailo Bodnarchuk "The history of the Codeception project"
Mykhailo Bodnarchuk "The history of the Codeception project"Mykhailo Bodnarchuk "The history of the Codeception project"
Mykhailo Bodnarchuk "The history of the Codeception project"Fwdays
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
PHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodePHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodeSWIFTotter Solutions
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress DevelopmentAdam Tomat
 
Web internship Yii Framework
Web internship  Yii FrameworkWeb internship  Yii Framework
Web internship Yii FrameworkNoveo
 
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.SundaySpout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.SundayRichard McIntyre
 
Django + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoDjango + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoJavier Abadía
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
So S.O.L.I.D Fu - Designing Better Code
So S.O.L.I.D Fu - Designing Better CodeSo S.O.L.I.D Fu - Designing Better Code
So S.O.L.I.D Fu - Designing Better CodeNeil Crookes
 
Better Testing With PHP Unit
Better Testing With PHP UnitBetter Testing With PHP Unit
Better Testing With PHP Unitsitecrafting
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormMichelangelo van Dam
 

Similar to From framework coupled code to microservices through DDD modules (20)

Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
Mykhailo Bodnarchuk "The history of the Codeception project"
Mykhailo Bodnarchuk "The history of the Codeception project"Mykhailo Bodnarchuk "The history of the Codeception project"
Mykhailo Bodnarchuk "The history of the Codeception project"
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 
PHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodePHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better Code
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 
Web internship Yii Framework
Web internship  Yii FrameworkWeb internship  Yii Framework
Web internship Yii Framework
 
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.SundaySpout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
 
Vue business first
Vue business firstVue business first
Vue business first
 
Django + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoDjango + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar Django
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
So S.O.L.I.D Fu - Designing Better Code
So S.O.L.I.D Fu - Designing Better CodeSo S.O.L.I.D Fu - Designing Better Code
So S.O.L.I.D Fu - Designing Better Code
 
Spout
SpoutSpout
Spout
 
Spout
SpoutSpout
Spout
 
Better Testing With PHP Unit
Better Testing With PHP UnitBetter Testing With PHP Unit
Better Testing With PHP Unit
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
WCLA12 JavaScript
WCLA12 JavaScriptWCLA12 JavaScript
WCLA12 JavaScript
 
Introduction to angular js
Introduction to angular jsIntroduction to angular js
Introduction to angular js
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
 
PHPSpec BDD Framework
PHPSpec BDD FrameworkPHPSpec BDD Framework
PHPSpec BDD Framework
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Recently uploaded (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

From framework coupled code to microservices through DDD modules

  • 1. From framework coupled code to microservices through DDD modules MVC, Testing, SOLID, Domain-Driven Design, Microservices @CodelyTV @Rafaoe
 @JavierCane#NubeloMeetup - IronHack 25/10/2016
  • 4. Contents gOld days The holy grail of testing Bigger & faster MVC frameworks to the rescue Serious business Recap
  • 5.
  • 8.
  • 9. <?php
 /**
 * The template for displaying all single posts and attachments
 *
 * @package WordPress
 * @subpackage Twenty_Sixteen
 * @since Twenty Sixteen 1.0
 */
 
 get_header(); ?>
 
 <div id="primary" class="content-area">
 <main id="main" class="site-main" role="main">
 <?php
 // Start the loop.
 while (have_posts()) : the_post();
 single.php
  • 10. role="main">
 <?php
 // Start the loop.
 while (have_posts()) : the_post();
 
 // Include the single post content template.
 get_template_part('template- parts/content', 'single');
 
 // If comments are open or we have at least one comment, load up the comment template.
 if (comments_open() || get_comments_number()) {
 comments_template();
 }
 
 if (is_singular('attachment')) {
 single.php
  • 11. ) . '</span> ' . '<span class="post-title">%title</span>',
 ]
 );
 }
 
 // End of the loop.
 endwhile;
 ?>
 
 </main><!-- .site-main -->
 
 <?php get_sidebar('content-bottom'); ?>
 
 </div><!-- .content-area -->
 
 <?php get_sidebar(); ?>
 <?php get_footer(); ?>
 single.php
  • 12. ! Scripts ◕ index.php ◕ utils.php ◕ helpers.php ◕ include & require_once The Concept gOld days
  • 13. ! Have to learn ◕ Mindset ◕ Toolset ◗ PHP – Namespaces y autoloader Composer ◗ PHP – Estilo de código, estándar PSR 2 ◗ Generación automática de código con IntelliJ y PhpStorm ◕ Domain ◗ Incomprehensible Finder Kata Refactoring ! All is The Concept The Concept gOld days
  • 14. ºº
  • 16. <?php
 
 class ctrl_frontend extends Controller {
 
 function ctrl_frontend()
 {
 parent::Controller(); 
 if (!isset($_SESSION)) {
 session_start();
 }
 }
 
 function index()
 {
 $this->load- >model('sobre_nosotros','',TRUE);
 
 THE Controller
  • 18. $datos);
 }
 
 private function sesionIniciada(){
 $this->load->helper('url');
 redirect('ctrl_backend_admin/ proyectoListar','refresh');
 }
 
 private function error($msg){
 $data["tipoError"]=$msg; 
 $this->load->view('error',$data);
 }
 }
 
 /* End of file welcome.php */
 /* Location: ./system/application/controllers/ welcome.php */
 THE Controller
  • 19.
  • 20.
  • 21. ! Wins ◕ Controller per concept ◕ Isolate views & DB ◕ Active Record discovery ! New ◕ Singletons, singletons everywhere ◕ “Models” & other misconceptions ◕ DB structure defined by ORM ! Still ◕ Highly coupled code ◕ “Software Architecture is for UML people” The Concept MVC frameworks to the rescue
  • 22. ! Internal doubts ◕ Por qué NO usar getters y setters | Tell don’t ask ◕ Por qué programar sin usar “else” – Cláusulas de guarda ◕ Varios returns en una función: ¿Mal o bien? ◕ Qué son los Code Smells y el Refactoring ◕ Constructores semánticos – Named constructors The Concept MVC frameworks to the rescue
  • 23. class CourseController extends FOSRestController
 {
 public function getCourseAction(Request $request)
 {
 return $this->getDoctrine()
 ->getEntityManager()
 ->createQueryBuilder()
 ->select('c', 'v')
 ->from('AppBundleModelCourse', 'c')
 ->where('c.level', '>', $request- >get('from_level', 0))
 ->getQuery()
 ->execute();
 }
 
 public function getCourseVideosAction($courseId)
 {
 return $this->getDoctrine()
 Course controller bit.ly/codelytv-course-ctrl-fw
  • 24. class Course extends CourseBaseModel
 {
 public $title;
 public $level;
 
 /**
 * @return mixed
 */
 public function getTitle()
 {
 return $this->title;
 }
 
 /**
 * @param mixed $title
 */
 public function setTitle($title)
 {
 $this->title = $title;
 Course model bit.ly/codelytv-course-model-anemic
  • 25. 3.
 The holy grail of testing
  • 26. ! Wins ◕ If you don’t test, you’re going to suffer ◕ SOLID at a micro-design scale ! New ◕ Fragile test due to coupled code bases ◕ Test private methods or not? ! Still ◕ Controller per concept ◕ “Models”, singletons & laravel “facades” The Concept The holy grail of testing
  • 27. class CourseControllerTest extends PHPUnit_Framework_TestCase
 {
 public function testGetCoursesFilteredByLevel()
 {
 $fromLevel = 0;
 $request = new Request(['from_level' => $fromLevel]);
 
 $container = Mockery::mock(ContainerInterface::class);
 $doctrine = Mockery::mock(Registry::class);
 $entityManager = Mockery::mock(EntityManager::class);
 $queryBuilder = Mockery::mock(QueryBuilder::class);
 $query = Course controller test
  • 28. 
 $controller = new CourseController();
 $controller->setContainer($container);
 $controllerResult = $controller- >getCourseAction($request);
 $this->assertEquals(
 [
 [
 'title' => 'Codely mola',
 'level' => 2,
 ],
 [
 'title' => 'Aprende a decir basicamente como Javi',
 'level' => 5,
 ],
 ],
 $controllerResult
 );
 }
 } Course controller test bit.ly/codelytv-course-ctrl-fw-test
  • 29. ! Testing help ◕ Cómo testear código acoplado: Costuras ◕ ¿Puedes ayudarte del #TDD para diseñar software? – Diseños emergentes ◕ Cómo escuchar a tus test #NaveMisterioCodelyTV ◕ Por qué no usar static ! SOLID ◕ Principio de Responsabilidad Única SRP ◕ Principio de Segregación de Interfaces ISP ◕ Errores comunes al diseñar Interfaces ◕ Principio de Inversión de Dependencias DIP The Concept The holy grail of testing
  • 31. ! Wins ◕ Decoupling business logic from framework ◕ Module per concept ◕ Semantics and clean code as something necessary ◕ Ease testing ◕ SOLID at a macro-design scale ◕ DB structure defined by domain ! New ◕ Unlearning process ◕ Deep research aptitude ◕ Theory misinterpretations The Concept Serious business
  • 32. The growth stages of a programmer 1st stage 2nd stage 3rd stage Knowledge Code complexity Non scientific source :P : https://www.youtube.com/watch?v=2qYll837a_0
  • 33. 
 final class VideoController extends Controller
 {
 private $bus;
 
 public function __construct(CommandBus $bus)
 {
 $this->bus = $bus;
 }
 
 public function createAction(
 string $id,
 Request $request
 ) {
 $command = new CreateVideoCommand(
 $id,
 $request->get('title'),
 $request->get('url'),
 $request->get('course_id')
 Video controller
  • 34. {
 $this->bus = $bus;
 }
 
 public function createAction(
 string $id,
 Request $request
 ) {
 $command = new CreateVideoCommand(
 $id,
 $request->get('title'),
 $request->get('url'),
 $request->get('course_id')
 );
 
 $this->bus->dispatch($command);
 
 return new HttpCreatedResponse();
 }
 }
 Video controller bit.ly/codelytv-video-ctrl
  • 35. final class CreateVideoCommandHandler implements Command
 {
 private $creator;
 
 public function __construct(VideoCreator $creator)
 {
 $this->creator = $creator;
 }
 
 public function __invoke(CreateVideoCommand $command)
 {
 $id = new VideoId($command->id());
 $title = new VideoTitle($command->title());
 $url = new VideoUrl($command->url());
 $courseId = new CourseId($command->courseId());
 
 $this->creator->create( $id, $title, $url, $courseId Create video command handler bit.ly/codelytv-video-handler
  • 36. final class VideoCreator
 {
 private $repository;
 private $publisher;
 
 public function __construct(
 VideoRepository $repository,
 DomainEventPublisher $publisher
 ) {
 $this->repository = $repository;
 $this->publisher = $publisher;
 }
 
 public function create(
 VideoId $id,
 VideoTitle $title,
 VideoUrl $url,
 CourseId $courseId
 Video creator application service
  • 37. DomainEventPublisher $publisher
 ) {
 $this->repository = $repository;
 $this->publisher = $publisher;
 }
 
 public function create(
 VideoId $id,
 VideoTitle $title,
 VideoUrl $url,
 CourseId $courseId
 ) {
 $video = Video::create($id, $title, $url, $courseId);
 
 $this->repository->save($video);
 
 $this->publisher->publish( $video->pullDomainEvents() );
 }
 Video creator application service bit.ly/codelytv-video-as
  • 38. final class Video extends AggregateRoot
 {
 private $id;
 private $title;
 private $url;
 private $courseId;
 
 public function __construct(
 VideoId $id,
 VideoTitle $title,
 VideoUrl $url,
 CourseId $courseId
 )
 {
 $this->id = $id;
 $this->title = $title;
 Video domain model
  • 39. $this->courseId = $courseId;
 }
 
 public static function create(
 VideoId $id,
 VideoTitle $title,
 VideoUrl $url,
 CourseId $courseId
 )
 {
 $video = new self($id, $title, $url, $courseId);
 
 $video->record( new VideoCreatedDomainEvent($id) );
 
 return $video;
 }
 Video domain model bit.ly/codelytv-video-model
  • 40. final class CreateVideoTest extends VideoModuleUnitTestCase
 {
 /** @var CreateVideoCommandHandler */
 private $handler;
 
 protected function setUp()
 {
 parent::setUp();
 
 $creator = new VideoCreator(
 $this->repository(),
 $this->domainEventPublisher()
 );
 
 $this->handler = new CreateVideoCommandHandler($creator);
 }
 
 /** @test */
 Create video test
  • 41. public function it_should_create_a_video()
 {
 $command = CreateVideoCommandStub::random();
 
 $video = VideoStub::fromRawValues(
 $command->id(),
 $command->title(),
 $command->url(),
 $command->courseId()
 );
 
 $event = VideoCreatedDomainEventStub::fromRawValues(
 $command->id(),
 $command->title(),
 $command->url(),
 $command->courseId()
 );
 
 $this->shouldSaveVideo($video);
 $this->shouldPublishDomainEvents([$event]);
 
 $this->dispatch($command, $this->handler);
 Create video test bit.ly/codelytv-video-test
  • 42. ! Tips / knowledge we’d like to have had ◕ Caso real de replanteamiento de diseño de Software ◕ Explicar Refactorings de forma didáctica – QWAN Cards ◕ Introducción Arquitectura Hexagonal – DDD The Concept Serious business
  • 44. ! Wins: ◕ (SOLID + Software Architecture theory + Testing) accomplished ◕ Bounded context (even microservices) per concept ◕ More teams ! New: ◕ Accidental complexity (infrastructure, coordination…) The Concept Bigger & faster
  • 46. ! There’s no silver bullet approach. All depends on the context, and the context will evolve. ! Conclusion: The Concept must be easy to promote with context evolutions ◕ From framework to modules: ◗ Decouple from outside infrastructure in order to isolate the domain ◗ Isolate use cases and work on cohesion ◕ From modules to Bounded Context: ◗ Decouple using buses to interact between them ◕ From whatever to Microservices: ◗ You don’t have to promote anything. This is not a change in terms source code but in terms of infrastructure The Concept Recap
  • 47. Tabla molona Framework coupled code Modules Bounded Contexts Microservices Learning curve Low Medium High High++ Teams autonomy Low Medium+ High High++ Infrastructure Shared (& coupled) Shared Individual Individual & distributed Code maintainability/ extensibility Low— High High+ High++ Infrastructure complexity Low Medium Medium High++++ Communication between them Coupled Buses Buses Distributed buses Deploy Shared Shared Shared Isolated We’re not promoting microservices per se. Due to infrastructure and accidental complexity It could be the worst option actually.
  • 49. Takeaways ! Unit Testing sucks (and it’s our fault) - José Armesto ! Vídeos sobre SOLID - CodelyTV ! Hexagonal Architecture - Chris Fidao ! Introducción Arquitectura Hexagonal – DDD - CodelyTV ! Domain-Driven Design in PHP - Carlos Buenosvinos, Christian Soronellas and Keyvan Akbary ! A wave of command buses - Matthias Noback ! How to Avoid Building a Distributed Monolith - Felipe Dornelas ! PHP Barcelona Monthly Talk: DDD Applied & Symfony MPWAR Edition - Sergi González & Eloi Poch ! Implementing Domain-Driven Design - Vaughn Vernon ! This talk repositories (to be published on github.com/CodelyTV)