Have you ever wondered how all this CQRS / ES concepts could be applied to a PHP project? Let's take a look at some code of our last project: a warehouse management system.
This talk will show how we understand DDD and how we apply it at Ulabox, what changes in application's architecture and code when we apply CQRS and how to deal with event sourcing, when there're no persisted entities, only events that generate projections used in the read model.
Speaker: Manel Sellés (@manelselles), software engineer, DDD-TDD fan and Symfony Expert Certified by Sensiolabs. Currently developing enterprise logistics software at Ulabox.com
Event sourcing w pigułce czyli podróże w czasie i odporność na coraz to bardziej kreatywne wymagania biznesowe. Kiedy, jak i po co tworzyć naturalny log wydarzeń Twojej aplikacji - plusy i minusy wzorca, przykłady implementacji, event sourcing a CQRS.
Introduction to CQRS and Event SourcingSamuel ROZE
Event Sourcing is the idea that every state of your application can be represented by a sequence of events. Using these two principles as the heart of a system or an application is quite common but can be challenging if we don’t use the right tools or architecture.
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
This document summarizes a presentation on building a rich domain model with Symfony2 and Doctrine2. It discusses modeling the domain by focusing on the problem space rather than the solution space. It emphasizes making the domain model ubiquitous by using a common language throughout the code and contexts. The presentation also covers using entities as both domain objects and persistence model objects, validating inputs and protecting invariants, and taking an iterative test-driven approach to developing the domain model.
The IoC Hydra - Dutch PHP Conference 2016Kacper Gunia
Slides from my talk presented during Dutch PHP Conference in Amsterdam - 25 June 2016
More Domain-Driven Design related content at: https://domaincentric.net/
Silex is a brand new PHP 5.3 micro framework built on top of the Symfony2 de decoupled components. In this session, we will discover how to build and deploy powerful REST web services with such a micro framework and its embedded tools.
The first part of this talk will introduce the basics of the REST architecture. We fill focus on the main concepts of REST like HTTP methods, URIs and open formats like XML and JSON.
Then, we will discover how to deploy REST services using most of interesting Silex tools like database abstraction layer, template engine and input validation. We will also look at unit and functional testing frameworks with PHPUnit and HTTP caching with Edge Side Includes and Varnish support to improve performances.
Event sourcing w pigułce czyli podróże w czasie i odporność na coraz to bardziej kreatywne wymagania biznesowe. Kiedy, jak i po co tworzyć naturalny log wydarzeń Twojej aplikacji - plusy i minusy wzorca, przykłady implementacji, event sourcing a CQRS.
Introduction to CQRS and Event SourcingSamuel ROZE
Event Sourcing is the idea that every state of your application can be represented by a sequence of events. Using these two principles as the heart of a system or an application is quite common but can be challenging if we don’t use the right tools or architecture.
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
This document summarizes a presentation on building a rich domain model with Symfony2 and Doctrine2. It discusses modeling the domain by focusing on the problem space rather than the solution space. It emphasizes making the domain model ubiquitous by using a common language throughout the code and contexts. The presentation also covers using entities as both domain objects and persistence model objects, validating inputs and protecting invariants, and taking an iterative test-driven approach to developing the domain model.
The IoC Hydra - Dutch PHP Conference 2016Kacper Gunia
Slides from my talk presented during Dutch PHP Conference in Amsterdam - 25 June 2016
More Domain-Driven Design related content at: https://domaincentric.net/
Silex is a brand new PHP 5.3 micro framework built on top of the Symfony2 de decoupled components. In this session, we will discover how to build and deploy powerful REST web services with such a micro framework and its embedded tools.
The first part of this talk will introduce the basics of the REST architecture. We fill focus on the main concepts of REST like HTTP methods, URIs and open formats like XML and JSON.
Then, we will discover how to deploy REST services using most of interesting Silex tools like database abstraction layer, template engine and input validation. We will also look at unit and functional testing frameworks with PHPUnit and HTTP caching with Edge Side Includes and Varnish support to improve performances.
This session introduces most well known design patterns to build PHP classes and objects that need to store and fetch data from a relational databases. The session will describe the difference between of the Active Record, the Table and Row Data Gateway and the Data Mapper pattern. We will also examine some technical advantages and drawbacks of these implementations. This talk will expose some of the best PHP tools, which ease database interactions and are built on top of these patterns.
Design Patterns avec PHP 5.3, Symfony et PimpleHugo Hamon
Cette conférence présente deux grands motifs de conception : l'observateur et l'injection de dépendance. Ce sujet allie à la fois théorie et pratique. Le composant autonome EventDispatcher de Symfony ainsi que le conteneur d'injection de dépendance Pimple sont mis à l'honneur avec des exemples pratiques d'usage. Ces cas pratiques combinent du code de l'ORM Propel ainsi que le composant autonome Zend\Search\Lucene du Zend Framework 2
This document summarizes the history of PHP persistence from 1995 to present day. It begins with early file handling in PHP/FI in 1995 and the introduction of database support. It then discusses the evolution of code reusability through functions and classes. Professional abstraction layers like PEAR and later ORM frameworks provided more robust and standardized APIs. NoSQL databases and drivers were later incorporated, moving beyond relational databases. Current frameworks provide object document mapping for non-SQL databases like MongoDB.
Un gioco in cui vincono tutti o due piccioni con una fava ;)
Lavorare rivolti alla creazione di valore per il cliente e da questo ottenere una libreria quasi pronta per essere pubblicata
Models and Service Layers, Hemoglobin and HobgoblinsRoss Tuck
As presented at ZendCon 2014, AmsterdamPHP, PHPBenelux 2014, Sweetlake PHP and PHP Northwest 2013, an overview of some different patterns for integrating and managing logic throughout your application.
Software development is riddled with explicit and implicit costs. Every decision you make has a cost attached to it. When you're writing code, you're making an investment, the size of which will for a long time define the costs of your future growth. Making right decision about these investments is very tricky and the cost of wrong decisions might be crippling for both business and teams that support it.
Extreme Programming and Test Driven Development in particular are practices that are aiming at supporting development effort by making it easier to introduce change. That said, sometimes those tools can become a problem of its own when applied in the wrong way or for the wrong context. Understanding software cost forces is a very important skill of successful teams and something that helps understand how to apply XP and TDD in different contexts.
How do you create applications with an incredible level of extendability without losing readability in the process? What if there's a way to separate concerns not only on the code, but on the service definition level? This talk will explore structural and behavioural patterns and ways to enrich them through tricks of powerful dependency injection containers such as Symfony2 DIC component.
CQRS and Event Sourcing in a Symfony applicationSamuel ROZE
The document discusses using CQRS and event sourcing in a Symfony application. It covers building the domain model to use events, storing events in a repository, using a message bus for commands and events, and creating projections from events for querying. Event handlers can trigger new commands, and projections rebuild data from events for fast reads. The approach allows an application to handle commands asynchronously through decoupled services while maintaining an immutable record of events for audit purposes.
This document discusses using Doctrine fixtures and the Faker library to generate fake test data for entities in a Symfony application. It explains how to install and configure Doctrine fixtures bundles, structure fixture classes, and load fixtures. It then covers installing and using the Faker library to generate random names, addresses, phone numbers and more. It provides examples of localizing Faker, seeding values, and generating unique or optional values. The document concludes by discussing using Faker to populate ORM entities and customizing population values.
What should you test with your unit tests? Some people will say that unit behaviour is best tested through it's outcomes. But what if communication between units itself is more important than the results of it? This session will introduce you to two different ways of unit-testing and show you a way to assert your object behaviours through their communications.
As presented at Dutch PHP Conference 2015, an introduction to command buses, how to implement your own in PHP and why they're both useful but unimportant.
This document discusses building web services using the Zend Framework. It introduces key components for building SOAP, XML-RPC, and RESTful services, including the Zend_Soap, Zend_XmlRpc, and Zend_Rest libraries. It provides an example of building a timesheet API and exposing it through different protocols, demonstrating how to define methods, handle requests and responses, and implement clients. Documentation of the API using docblocks is also covered.
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
1. The document discusses strategies for optimizing software costs, including the costs of introduction, change, and ownership over the lifetime of a project.
2. It emphasizes focusing on optimizing for cost of introduction early on, as this cost is relatively easy to optimize and loses relevance over time. However, cost of change increases exponentially and is most important to optimize for longer-term projects.
3. Cost of ownership involves ongoing maintenance and allows balancing the costs of introduction and change by selectively taking ownership of only necessary logic through techniques like testing and refactoring.
Closing keynote, as presented at Codemotion 2014, LaraconEU 2014, Redevelop 2014, CodeConnexx 2013 and PHP North East 2014.
This presentation makes a reference to a reading list I received. For those interested, the release consists of most of the general classics, such as Gang Of Four "Design Patterns", The Pragmatic Programmer, Structure and Interpretation of Computer Programs, Domain Driven Design and a few others. The actual list remains tucked away in a box somewhere.
Come to this talk prepared to learn about the Doctrine PHP open source project. The Doctrine project has been around for over a decade and has evolved from database abstraction software that dates back to the PEAR days. The packages provided by the Doctrine project have been downloaded almost 500 million times from packagist. In this talk we will take you through how to get started with Doctrine and how to take advantage of some of the more advanced features.
Symfony World - Symfony components and design patternsŁukasz Chruściel
There are so many Symfony components already, and they have some pretty neat perks. But have you seen them in action?
Design patterns are not a silver bullet. They will never resolve your problem on their own. On the other hand, design patterns provide a common ground for developers without going into details and could be used as building bricks to solve some more advanced problems.
During my presentation, I will take a closer look and explain the appliance of selected design patterns. What is more, I will take advantage of the Symfony ecosystem to implement them with ease.
I will do the presentation on sample code that developers will understand at all levels of expertise.
CQRS & Event Sourcing in the wild (ScotlandPHP 2016)Michiel Rook
CQRS & event sourcing are currently very popular topics in the PHP community, with good reason. However, most blogs and talks focus on the theory, simple applications or introductions to one of the frameworks currently available, not necessarily the challenges of using and maintaining it in production.
This session bridges that gap and looks at some of the pitfalls of a real-world deployment. I'll discuss topics like concurrency & scale, refactoring events and updating read models. Attend this talk to learn from my experiences and be better prepared when you face these challenges.
Refactorizando Pccomponentes.com con SymfonyMario Marín
Partimos de un reto: cómo cambiar una web con millones de visitas, con un entorno en constante cambio, con una deuda técnica crítica y un equipo aumentando en número, en procesos para la generación de software de manera automatizada, documentada, probada y coordinada para la consecución de nuestras metas.
En esta charla se presenta el caso práctico de la implantación de Symfony como pieza fundamental del puzzle y la integración continua como camino a seguir. Pruebas, integración, bundles, bases de datos, rendimiento... Aspectos claves para la consecución de nuestros objetivos.
Introduction to hexagonal architectureManel Sellés
This document discusses hexagonal architecture, an approach to software design that aims to decouple code and make applications independent of external resources. It outlines some issues with traditional MVC architecture, like duplication when additional interfaces are needed. Hexagonal architecture addresses this through dependency injection and interfaces. Core business logic is separated from interfaces, databases can be swapped out by implementing different interfaces, and changes are isolated within layers. The goal is independent, decoupled code that is flexible and adaptable to new requirements and technologies.
This session introduces most well known design patterns to build PHP classes and objects that need to store and fetch data from a relational databases. The session will describe the difference between of the Active Record, the Table and Row Data Gateway and the Data Mapper pattern. We will also examine some technical advantages and drawbacks of these implementations. This talk will expose some of the best PHP tools, which ease database interactions and are built on top of these patterns.
Design Patterns avec PHP 5.3, Symfony et PimpleHugo Hamon
Cette conférence présente deux grands motifs de conception : l'observateur et l'injection de dépendance. Ce sujet allie à la fois théorie et pratique. Le composant autonome EventDispatcher de Symfony ainsi que le conteneur d'injection de dépendance Pimple sont mis à l'honneur avec des exemples pratiques d'usage. Ces cas pratiques combinent du code de l'ORM Propel ainsi que le composant autonome Zend\Search\Lucene du Zend Framework 2
This document summarizes the history of PHP persistence from 1995 to present day. It begins with early file handling in PHP/FI in 1995 and the introduction of database support. It then discusses the evolution of code reusability through functions and classes. Professional abstraction layers like PEAR and later ORM frameworks provided more robust and standardized APIs. NoSQL databases and drivers were later incorporated, moving beyond relational databases. Current frameworks provide object document mapping for non-SQL databases like MongoDB.
Un gioco in cui vincono tutti o due piccioni con una fava ;)
Lavorare rivolti alla creazione di valore per il cliente e da questo ottenere una libreria quasi pronta per essere pubblicata
Models and Service Layers, Hemoglobin and HobgoblinsRoss Tuck
As presented at ZendCon 2014, AmsterdamPHP, PHPBenelux 2014, Sweetlake PHP and PHP Northwest 2013, an overview of some different patterns for integrating and managing logic throughout your application.
Software development is riddled with explicit and implicit costs. Every decision you make has a cost attached to it. When you're writing code, you're making an investment, the size of which will for a long time define the costs of your future growth. Making right decision about these investments is very tricky and the cost of wrong decisions might be crippling for both business and teams that support it.
Extreme Programming and Test Driven Development in particular are practices that are aiming at supporting development effort by making it easier to introduce change. That said, sometimes those tools can become a problem of its own when applied in the wrong way or for the wrong context. Understanding software cost forces is a very important skill of successful teams and something that helps understand how to apply XP and TDD in different contexts.
How do you create applications with an incredible level of extendability without losing readability in the process? What if there's a way to separate concerns not only on the code, but on the service definition level? This talk will explore structural and behavioural patterns and ways to enrich them through tricks of powerful dependency injection containers such as Symfony2 DIC component.
CQRS and Event Sourcing in a Symfony applicationSamuel ROZE
The document discusses using CQRS and event sourcing in a Symfony application. It covers building the domain model to use events, storing events in a repository, using a message bus for commands and events, and creating projections from events for querying. Event handlers can trigger new commands, and projections rebuild data from events for fast reads. The approach allows an application to handle commands asynchronously through decoupled services while maintaining an immutable record of events for audit purposes.
This document discusses using Doctrine fixtures and the Faker library to generate fake test data for entities in a Symfony application. It explains how to install and configure Doctrine fixtures bundles, structure fixture classes, and load fixtures. It then covers installing and using the Faker library to generate random names, addresses, phone numbers and more. It provides examples of localizing Faker, seeding values, and generating unique or optional values. The document concludes by discussing using Faker to populate ORM entities and customizing population values.
What should you test with your unit tests? Some people will say that unit behaviour is best tested through it's outcomes. But what if communication between units itself is more important than the results of it? This session will introduce you to two different ways of unit-testing and show you a way to assert your object behaviours through their communications.
As presented at Dutch PHP Conference 2015, an introduction to command buses, how to implement your own in PHP and why they're both useful but unimportant.
This document discusses building web services using the Zend Framework. It introduces key components for building SOAP, XML-RPC, and RESTful services, including the Zend_Soap, Zend_XmlRpc, and Zend_Rest libraries. It provides an example of building a timesheet API and exposing it through different protocols, demonstrating how to define methods, handle requests and responses, and implement clients. Documentation of the API using docblocks is also covered.
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
1. The document discusses strategies for optimizing software costs, including the costs of introduction, change, and ownership over the lifetime of a project.
2. It emphasizes focusing on optimizing for cost of introduction early on, as this cost is relatively easy to optimize and loses relevance over time. However, cost of change increases exponentially and is most important to optimize for longer-term projects.
3. Cost of ownership involves ongoing maintenance and allows balancing the costs of introduction and change by selectively taking ownership of only necessary logic through techniques like testing and refactoring.
Closing keynote, as presented at Codemotion 2014, LaraconEU 2014, Redevelop 2014, CodeConnexx 2013 and PHP North East 2014.
This presentation makes a reference to a reading list I received. For those interested, the release consists of most of the general classics, such as Gang Of Four "Design Patterns", The Pragmatic Programmer, Structure and Interpretation of Computer Programs, Domain Driven Design and a few others. The actual list remains tucked away in a box somewhere.
Come to this talk prepared to learn about the Doctrine PHP open source project. The Doctrine project has been around for over a decade and has evolved from database abstraction software that dates back to the PEAR days. The packages provided by the Doctrine project have been downloaded almost 500 million times from packagist. In this talk we will take you through how to get started with Doctrine and how to take advantage of some of the more advanced features.
Symfony World - Symfony components and design patternsŁukasz Chruściel
There are so many Symfony components already, and they have some pretty neat perks. But have you seen them in action?
Design patterns are not a silver bullet. They will never resolve your problem on their own. On the other hand, design patterns provide a common ground for developers without going into details and could be used as building bricks to solve some more advanced problems.
During my presentation, I will take a closer look and explain the appliance of selected design patterns. What is more, I will take advantage of the Symfony ecosystem to implement them with ease.
I will do the presentation on sample code that developers will understand at all levels of expertise.
CQRS & Event Sourcing in the wild (ScotlandPHP 2016)Michiel Rook
CQRS & event sourcing are currently very popular topics in the PHP community, with good reason. However, most blogs and talks focus on the theory, simple applications or introductions to one of the frameworks currently available, not necessarily the challenges of using and maintaining it in production.
This session bridges that gap and looks at some of the pitfalls of a real-world deployment. I'll discuss topics like concurrency & scale, refactoring events and updating read models. Attend this talk to learn from my experiences and be better prepared when you face these challenges.
Refactorizando Pccomponentes.com con SymfonyMario Marín
Partimos de un reto: cómo cambiar una web con millones de visitas, con un entorno en constante cambio, con una deuda técnica crítica y un equipo aumentando en número, en procesos para la generación de software de manera automatizada, documentada, probada y coordinada para la consecución de nuestras metas.
En esta charla se presenta el caso práctico de la implantación de Symfony como pieza fundamental del puzzle y la integración continua como camino a seguir. Pruebas, integración, bundles, bases de datos, rendimiento... Aspectos claves para la consecución de nuestros objetivos.
Introduction to hexagonal architectureManel Sellés
This document discusses hexagonal architecture, an approach to software design that aims to decouple code and make applications independent of external resources. It outlines some issues with traditional MVC architecture, like duplication when additional interfaces are needed. Hexagonal architecture addresses this through dependency injection and interfaces. Core business logic is separated from interfaces, databases can be swapped out by implementing different interfaces, and changes are isolated within layers. The goal is independent, decoupled code that is flexible and adaptable to new requirements and technologies.
The document discusses testing software code. It defines what testing is, why it is useful, and how it differs from debugging. It provides examples of unit testing a Fibonacci function using assertions and coverage. It discusses test doubles that can substitute dependencies, and principles for writing testable code like avoiding globals, composition over inheritance, and dependency injection. Finally, it mentions test-driven development and the roles of QA, testers, and developers in testing.
The slides of the try out of my new talk "CQRS & event sourcing in the wild" - held at PHP Amersfoort in September 2016.
CQRS & event sourcing are currently very popular topics in the PHP community. However, most blogs and talks focus on the theory, simple applications or introductions to one of the CQRS / event sourcing frameworks currently available for PHP, not necessarily the challenges of a production deployment.
In this session we will try to bridge that gap and look at some of the issues that popped up during a real-world deployment of an event sourced application. We’ll discuss a few strategies to deal with these issues and how they would apply to current PHP event sourcing frameworks.
Integrando React.js en aplicaciones Symfony (deSymfony 2016)Ignacio Martín
Introducción a React.js + técnicas y conceptos útiles, como aplicaciones universales (isomórficas) o cómo usar json schema para facilitarnos la vida al trabajar con formularios.
As businesses grow, so does the complexity of their software. New features, new models, and new background processes all continue to be added. . .and developers struggle to make sense of it all. Yet the end user demands a swift and functional experience when interacting with your application. It is paramount to be open to alternative patterns that help tame complex, high-demand services. Two such patterns are command-query responsibility segregation (CQRS) and event sourcing (ES).
Command-query responsibility segregation is an architectural pattern for user-facing applications that extends from the now standard Model-View-Controller (MVC) pattern and is an alternative to the CRUD pattern. At its core, CQRS is about changing how we think of and work with our data by introducing two types of models: all user actions become commands, and a read-only query model powers our views. Commands and queries are logistically separated, providing additional decoupling of our application. CQRS also calls for changes in how we store and structure our data.
Enter event sourcing. Instead of persisting the current state of our domain objects or entities, we record historical events about our data. The key advantage is that we can examine our application data at any point in time, rather than just the current state. This pattern changes how we persist and process our data but is surprisingly efficient.
While each of the two patterns can be used exclusively, they complement each other beautifully and facilitate the construction of decoupled, scalable applications or individual services. Stephen Pember explores the fundamentals of each pattern and offers several examples and demonstration code to show how one might actually go about implementing CQRS and ES. Steve discusses task-based UIs and domain-driven design as he outlines some of the advantages—and challenges—that ThirdChannel has seen when developing systems using CQRS and ES over the past year.
This document provides an overview of CQRS (Command Query Responsibility Segregation) and Event Sourcing patterns when dealing with distributed systems and databases. It discusses that in distributed systems, it is not possible to satisfy all three guarantees of consistency, availability and partition tolerance at the same time according to Brewer's CAP theorem. It also describes how CQRS separates read and write concerns to improve scalability. Event Sourcing is proposed as a way to store all state changes as a sequence of events to make systems more robust and able to replay past states. Projections are used to transform event streams into data views.
Microservice Architecture with CQRS and Event SourcingBen Wilcock
This document provides an overview of microservice architecture using CQRS (Command Query Responsibility Segregation) and Event Sourcing patterns. It defines CQRS as separating the write and read functions of an application. Event Sourcing records all state changes as a series of events rather than just the current state. The benefits include scalability, simplicity, flexibility and a business focus. Popular companies using this architecture include those needing cost-effective scaling like microservices. The author provides resources and advocates for CQRS and Event Sourcing to solve common architectural challenges.
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...Chris Richardson
Modern, cloud-native applications typically use a microservices architecture in conjunction with NoSQL and/or sharded relational databases. However, in order to successfully use this approach you need to solve some distributed data management problems including how to maintain consistency between multiple databases without using 2PC.
In this talk you will learn more about these issues and how to solve them by using an event-driven architecture. We will describe how event sourcing and Command Query Responsibility Segregation (CQRS) are a great way to realize an event-driven architecture. You will learn about a simple yet powerful approach for building, modern, scalable applications.
This document provides an overview of the different technology stacks used at Ulabox for their clients, machinery systems, business integrations, warehouses, and delivery routes.
It discusses the stacks used for web and mobile clients, systems and devops tools, business integrations with third parties, warehouse management, and delivery routing. For each area, it identifies common issues and provides tips for addressing them, such as fixing performance issues quickly, having a single source of truth, and focusing on user needs above technology choices.
The document aims to help others learn from Ulabox's experience in building and maintaining systems across their full technology stack to run their online grocery business.
This document discusses microservices architecture and principles. It notes that a monolithic design leads to tight coupling that prevents independent scaling of modules. Microservices architecture aims to allow individual parts of a system to scale independently through looser coupling, autonomous services, and clear separation of concerns. Key principles for microservices include that they should be independently deployable, communicate through events and APIs, and that each service handle a specific task rather than representing an entire business entity.
This document provides an overview of CQRS (Command Query Responsibility Segregation) and related concepts like event sourcing. It defines key terms like command, query, event and discusses how CQRS architectures separate reads from writes. It also covers how event sourcing stores an entire series of events to maintain and replay state. The document evaluates when CQRS may or may not be a good fit and provides several links to additional CQRS resources and example projects.
This document outlines Greg Young's Simple CQRS sample which demonstrates core classes, initialization, and commands and events using CQRS. It includes classes for the core, initialization, commands and events, and shows the command/event sequence.
From framework coupled code to #microservices through #DDD /by @codelytvCodelyTV
From framework coupled code to microservices through DDD modules. The presentation discussed the evolution from monolithic frameworks to microservices architecture through various stages:
1) Old days of framework coupled code with low autonomy, maintainability and learning curve.
2) Use of MVC frameworks improved isolation but code was still highly coupled.
3) Focus on testing drove adoption of SOLID principles at a micro scale.
4) Domain-Driven Design introduced modules per domain concept improving decoupling, semantics and testability.
5) Further decomposition into bounded contexts and microservices provided more autonomy for teams but introduced new accidental complexities around infrastructure and coordination.
Hexagonal architecture - message-oriented software design (PHP Barcelona 2015)Matthias Noback
Commands, events, queries - three types of messages that travel through your application. Some originate from the web, some from the command-line. Your application sends some of them to a database, or a message queue. What is the ideal infrastructure for an application to support this on-going stream of messages? What kind of architectural design fits best? This talk provides answers to these questions: we take the *hexagonal* approach to software architecture. We look at messages, how they cross boundaries and how you can make steady communication lines between your application and other systems, like web browsers, terminals, databases and message queues. You will learn how to separate the technical aspects of these connections from the core behavior of your application by implementing design patterns like the *command bus*, and design principles like *dependency inversion*.
If you have used Facebook's React library, then you are familiar with the concept of application state. React components are, at their core (and as noted in the official documentation), simple state machines. This declarative approach to building a UI may take some adjusting to, but it ultimately simplifies kludgy imperative code into smaller, much more manageable pieces.
This pattern of manipulating state and responding to those changes can be implemented to great effect using the Symfony Event Dispatcher. This talk will step through this state-based approach to building an easily maintained and testable PHP application, tease out a few gotchas, and share real-world applications.
The document summarizes what's new in Axon 3, an event sourcing and CQRS framework. Key updates include support for Java 8 features like lambda expressions, dropping Spring XML in favor of Java configuration, simplifying event sourcing and aggregate modeling, adding monitoring and metrics collection, and plans for further enhancements around distributed capabilities and high performance. The presentation highlights major API changes and simplifications to reduce complexity and make the framework easier to use.
Why is crud a bad idea - focus on real scenariosDivante
This document discusses why CRUD (Create, Read, Update, Delete) is generally not a good approach for designing application code and APIs. It argues that entities should follow real business rules and scenarios rather than allowing arbitrary setting of attributes. Setters in particular are problematic as they don't map to real-world actions and don't enforce data integrity. The document recommends focusing on expressive methods that model real use cases rather than generic update operations. It also discusses how to add a CRUD layer on top of an internal domain model if needed while still maintaining encapsulation. The key takeaway is that applications should be designed around rich domain objects and real business behaviors rather than simple data access patterns.
This document discusses principles for improving modularity and maintainability through a layered data model approach. It recommends removing hard-coded dependencies and using a service manager to dynamically resolve components. Entities should represent data and focus only on their own tasks while abstracting away data storage details. A layered approach separates concerns with entities at the top holding information, tables handling storage operations, table gateways acting as the database interface, and hydrators mapping between objects and data. Together this improves reusability, flexibility and maintainability of the system.
Singletons in PHP - Why they are bad and how you can eliminate them from your...go_oh
While Singletons have become a Pattern-Non-Grata over the years, you still find it surprisingly often in PHP applications and frameworks. This talk will explain what the Singleton pattern is, how it works in PHP and why you should avoid it in your application.
You’ve seen Kris’ open source libraries, but how does he tackle coding out an application? Walk through green fields with a Symfony expert as he takes his latest “next big thing” idea from the first line of code to a functional prototype. Learn design patterns and principles to guide your way in organizing your own code and take home some practical examples to kickstart your next project.
Building Lithium Apps (Like a Boss) was a workshop presented on the structure and philosophy of the Lithium framework and its applications, and how best to take advantage of them.
This document discusses Domain Driven Design (DDD) value objects. It defines value objects as immutable objects that measure or describe a concept but have no identity. Their equality is based on attribute values rather than identity. The document outlines characteristics of value objects such as being immutable, having attributes that form a conceptual whole, being replaceable, supporting equality comparisons, and having side-effect-free methods. It provides examples of value objects and discusses standard types, storage, testing, implementations, and resources for further information on DDD value objects.
Drupal 8 Services And Dependency InjectionPhilip Norton
Using the service manager is an essential part of a Drupal 8 developers toolkit and understanding it not only helps development, but can also allow you to create modules that can be easily used by other developers. There are numerous code examples out there that talk about using this or that service, so I'll look at how to go from "\Drupal::service('thing');" to finding and using services within Drupal 8. I will look at creating custom services to use within your own modules and provide injectable dependencies for other modules. I will also show how to override services to provide your own functionality to existing services. All code shown will be real examples that you can take away and use in your own projects.
Given at DrupalCamp London 2018
Traditionally, we create structural models for our applications, and store the state of these models in our databases.
But there are alternatives: Event Sourcing is the idea that you can store all the domain events that affect an entity, and replay these events to restore the object's state. This may sound counterintuitive, because of all the years we've spent building relational, denormalized database schemas. But it is in fact quite simple, elegant, and powerful.
In the past year, I've had the pleasure of building and shipping two event sourced systems. In this session, I will show practical code, to give you a feel of how you can build event sourced models using PHP.
Mathias Verraes is a recovering music composer turned programmer, consultant, blogger, speaker, and podcaster. He advises companies on how to build enterprise web applications for complex business domains . For some weird reason, he enjoys working on large legacy projects: the kind where there’s half a million lines of spaghetti code, and nobody knows how to get the codebase under control. He’s the founder of the Domain-Driven Design Belgium community. When he’s not working, he’s at home in Kortrijk, Belgium, helping his two sons build crazy Lego train tracks.
http://verraes.net
This document provides an overview of using the Backbone.js framework for client-side MVC applications. It discusses why Backbone is useful for structuring JavaScript applications, its core architecture including models, collections, views and routers. It also provides examples of how to convert jQuery code to use a Backbone-based approach and lists some real-world applications that use Backbone.
This document discusses using CakePHP to develop an e-commerce application that integrates with Amazon's APIs. It describes extending CakePHP controllers and models to work with Amazon data, using ClassRegistry to initialize models within models' constructors, and testing with a custom database configuration for the Amazon data source. Key classes and behaviors are extended, and a class registry pattern is implemented to reduce duplication and improve organization.
Presentation of the command dispatcher pattern I made during one of the chapter meetings in HelloFresh.
Companion article: https://olvlvl.com/2018-04-command-dispatcher-pattern
This document discusses lazy evaluation and asynchronous data processing in Drupal. It describes using queues to process data later through background tasks instead of during page loads. This improves performance, reliability, and scalability. It provides examples of adding items to queues, defining queue handlers, and using queue services like RabbitMQ or SQS. It also discusses queue management modules and processing jobs in parallel using HTTPRL.
This document discusses several common design patterns used in software development including Singleton, Registry, Factory, Adapter, Decorator, and Observer. It provides examples of how each pattern can be implemented in PHP code. The Singleton pattern ensures only one instance of a class can exist. The Registry pattern acts as a singleton for singletons. The Factory pattern handles object creation. The Adapter pattern makes one interface compatible with another. The Decorator pattern allows behavior to be added to individual objects. The Observer pattern notifies observers when a subject changes state.
Hannes Van De Vreken, Software Engineer из Бельгии на конференции CODEID – PHP Odessa Conf #5 презентовал доклад на тему «IoC container beyond constructor injection».
Did you know your IoC container can do a whole lot more than just constructor injection? Besides that it is actually packed with features. Inflectors, resolving callbacks, aliasing, method invocation to name a few. In this talk you will learn how to leverage the power of a great container and service providers to write better, loosely coupled code. Well designed code put together by your IoC container will make your applications SOLID, modular, lean and decoupled from the framework!
CODEiD – это всеукраинское сообщество PHP-разработчиков. Наша цель — создать сильное сообщество всех, кто увлечен PHP-разработкой, и принимать в нашем уютном приморском городе коллег со всей Украины и мира.
The document discusses API design in PHP for the Ning platform. It covers how the PHP API provides an interface to the Ning REST APIs, which are used for content storage, user profiles, tagging, search, and more. Examples are given of using the PHP XN_Content class to create and save content to the REST API. The document emphasizes designing APIs that promote predictability, stability, and human performance over computer performance.
Go beyond the documentation and explore some of what's possible if you stretch symfony to its limits. We will look at a number of aspects of symfony 1.4 and Doctrine 1.2 and tease out some powerful functionality you may not have expected to find, but will doubtless be able to use. Topics covered will include routing, forms, the config cache and record listeners. If you're comfortable in symfony and wondering what's next, this session is for you.
Cómo crear un tipo de entidad en Drupal 8 desde el principio. Definición de la nueva entidad, especificación de campos y formulario, handlers, validaciones y renderización.
Sesión impartida en el DrupalDay 2017 en Santiago de Compostela.
Vídeo quí. No se me ve a mi, pero se ven las slides y se escucha perfectamente:
https://vimeo.com/192773521
This document discusses event sourcing principles and implementation with PHP. It begins by defining core event sourcing concepts like storing all changes rather than just the current state. It then demonstrates building a domain model for a vehicle parking app using events. Events are emitted and persisted to a simple file-based event store. Finally, it discusses projections or read models that can be derived from the event stream to represent state in different ways.
Hand Rolled Applicative User ValidationCode KataPhilip Schwarz
Could you use a simple piece of Scala validation code (granted, a very simplistic one too!) that you can rewrite, now and again, to refresh your basic understanding of Applicative operators <*>, <*, *>?
The goal is not to write perfect code showcasing validation, but rather, to provide a small, rough-and ready exercise to reinforce your muscle-memory.
Despite its grandiose-sounding title, this deck consists of just three slides showing the Scala 3 code to be rewritten whenever the details of the operators begin to fade away.
The code is my rough and ready translation of a Haskell user-validation program found in a book called Finding Success (and Failure) in Haskell - Fall in love with applicative functors.
Flutter is a popular open source, cross-platform framework developed by Google. In this webinar we'll explore Flutter and its architecture, delve into the Flutter Embedder and Flutter’s Dart language, discover how to leverage Flutter for embedded device development, learn about Automotive Grade Linux (AGL) and its consortium and understand the rationale behind AGL's choice of Flutter for next-gen IVI systems. Don’t miss this opportunity to discover whether Flutter is right for your project.
UI5con 2024 - Bring Your Own Design SystemPeter Muessig
How do you combine the OpenUI5/SAPUI5 programming model with a design system that makes its controls available as Web Components? Since OpenUI5/SAPUI5 1.120, the framework supports the integration of any Web Components. This makes it possible, for example, to natively embed own Web Components of your design system which are created with Stencil. The integration embeds the Web Components in a way that they can be used naturally in XMLViews, like with standard UI5 controls, and can be bound with data binding. Learn how you can also make use of the Web Components base class in OpenUI5/SAPUI5 to also integrate your Web Components and get inspired by the solution to generate a custom UI5 library providing the Web Components control wrappers for the native ones.
Malibou Pitch Deck For Its €3M Seed Roundsjcobrien
French start-up Malibou raised a €3 million Seed Round to develop its payroll and human resources
management platform for VSEs and SMEs. The financing round was led by investors Breega, Y Combinator, and FCVC.
WWDC 2024 Keynote Review: For CocoaCoders AustinPatrick Weigel
Overview of WWDC 2024 Keynote Address.
Covers: Apple Intelligence, iOS18, macOS Sequoia, iPadOS, watchOS, visionOS, and Apple TV+.
Understandable dialogue on Apple TV+
On-device app controlling AI.
Access to ChatGPT with a guest appearance by Chief Data Thief Sam Altman!
App Locking! iPhone Mirroring! And a Calculator!!
Most important New features of Oracle 23c for DBAs and Developers. You can get more idea from my youtube channel video from https://youtu.be/XvL5WtaC20A
E-commerce Development Services- Hornet DynamicsHornet Dynamics
For any business hoping to succeed in the digital age, having a strong online presence is crucial. We offer Ecommerce Development Services that are customized according to your business requirements and client preferences, enabling you to create a dynamic, safe, and user-friendly online store.
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemPeter Muessig
Learn about the latest innovations in and around OpenUI5/SAPUI5: UI5 Tooling, UI5 linter, UI5 Web Components, Web Components Integration, UI5 2.x, UI5 GenAI.
Recording:
https://www.youtube.com/live/MSdGLG2zLy8?si=INxBHTqkwHhxV5Ta&t=0
Unveiling the Advantages of Agile Software Development.pdfbrainerhub1
Learn about Agile Software Development's advantages. Simplify your workflow to spur quicker innovation. Jump right in! We have also discussed the advantages.
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfVALiNTRY360
Salesforce Healthcare CRM, implemented by VALiNTRY360, revolutionizes patient management by enhancing patient engagement, streamlining administrative processes, and improving care coordination. Its advanced analytics, robust security, and seamless integration with telehealth services ensure that healthcare providers can deliver personalized, efficient, and secure patient care. By automating routine tasks and providing actionable insights, Salesforce Healthcare CRM enables healthcare providers to focus on delivering high-quality care, leading to better patient outcomes and higher satisfaction. VALiNTRY360's expertise ensures a tailored solution that meets the unique needs of any healthcare practice, from small clinics to large hospital systems.
For more info visit us https://valintry360.com/solutions/health-life-sciences
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...XfilesPro
Wondering how X-Sign gained popularity in a quick time span? This eSign functionality of XfilesPro DocuPrime has many advancements to offer for Salesforce users. Explore them now!
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesQuickdice ERP
Explore the seamless transition to e-invoicing with this comprehensive guide tailored for Saudi Arabian businesses. Navigate the process effortlessly with step-by-step instructions designed to streamline implementation and enhance efficiency.
4. When CQRS meets Event Sourcing / Warehouse
Warehouse management system
● PHP and framework agnostic
○ (almost) all of us love Symfony
● Independent of other systems
○ Ulabox ecosystem is complex -> Microservices
● Extensible and maintainable
○ Testing
● The system must log every action
○ Event driven architecture
7. When CQRS meets Event Sourcing / Good practices
Outside-in TDD
● Behat features
● Describe behaviour with PhpSpec
● Testing integration with database of repository methods with Phpunit
8. When CQRS meets Event Sourcing / Good practices
Continuous integration
9. When CQRS meets Event Sourcing / Good practices
Other good practices
● SOLID
● Coding Style
● Pair programming
● Refactor
13. When CQRS meets Event Sourcing / DDD-Hexagonal
Hexagonal architecture
14. namespace UlaboxChangoInfrastructureUiHttpController;
class ReceptionController
{
public function addContainerAction(JsonApiRequest $request, $receptionId)
{
$containerPayload = $this->jsonApiTransformer->fromPayload($request->jsonData(), 'container');
$this->receptionService->addContainer(ReceptionId::fromString($receptionId), $containerPayload);
return JsonApiResponse::createJsonApiData(200, null, []);
}
}
namespace UlaboxChangoInfrastructureUiAmqpConsumer;
class ContainerAddedToReceptionConsumer extends Consumer
{
public function execute(AMQPMessage $rabbitMessage)
{
$message = $this->messageBody($rabbitMessage);
$containerPayload = $this->amqpTransformer->fromPayload($message, 'container');
$this->receptionService->addContainer(ReceptionId::fromString($message['reception_id']), $containerPayload);
return ConsumerInterface::MSG_ACK;
}
}
15. namespace UlaboxChangoApplicationService;
class ReceptionService
{
public function addContainer(ReceptionId $receptionId, ContainerPayload $payload)
{
$reception = $this->receptionRepository->get($receptionId);
$reception->addContainer($payload->temperature(), $payload->lines());
$this->receptionRepository->save($reception);
$this->eventBus->dispatch($reception->recordedEvents());
}
}
16. When CQRS meets Event Sourcing / DDD-Hexagonal
Why application service?
● Same entry point
● Coordinate tasks on model
● Early checks
● User authentication
17. namespace UlaboxChangoDomainModelReception;
class Reception extends Aggregate
{
public function addContainer(Temperature $temperature, array $containerLines)
{
Assertion::allIsInstanceOf($containerLines, ContainerLinePayload::class);
$containerId = ContainerId::create($this->id(), $temperature, count($this->containers));
$this->containers->set((string) $containerId, new Container($containerId, $temperature));
$this->recordThat(new ContainerWasAdded($this->id, $containerId, $temperature));
foreach ($containerLines as $line) {
$this->addLine($containerId, $line->label(), $line->quantity(), $line->type());
}
}
public function addLine(ContainerId $containerId, Label $label, LineQuantity $quantity, ItemType $type)
{
if (!$container = $this->containers->get((string) $containerId)) {
throw new EntityNotFoundException("Container not found");
}
$container->addLine(ContainerLine::create($label, $quantity, $type));
$this->recordThat(new ContainerLineWasAdded($this->id, $containerId, $label, $quantity, $type));
}
}
18. namespace UlaboxChangoDomainModelReceptionContainer;
class Container
{
public function __construct(ContainerId $id, Temperature $temperature)
{
$this->id = $id;
$this->temperature = $temperature;
$this->lines = new ArrayCollection();
$this->status = ContainerStatus::PENDING();
}
public function addLine(ContainerLine $line)
{
if ($this->containsLine($line->label())) {
throw new AlreadyRegisteredException("Line already exists");
}
$this->lines->set((string) $line->label(), $line);
}
}
21. When CQRS meets Event Sourcing / CQRS
CQRS
Separate:
● Command: do something
● Query: ask for something
Different source of data for read and write:
● Write model with DDD tactical patterns
● Read model with listeners to events
22. When CQRS meets Event Sourcing / CQRS
Command bus
● Finds handler for each action
● Decoupled command creator and handler
● Middlewares
○ Transactional
○ Logging
● Asynchronous actions
● Separation of concerns
23. When CQRS meets Event Sourcing / CQRS
Event bus
● Posted events are delivered to matching event handlers
● Decouples event producers and reactors
● Middlewares
○ Rabbit
○ Add correlation id
● Asynchronous actions
● Separation of concerns
25. namespace UlaboxChangoApplicationService;
class ReceptionService
{
public function addContainer(ReceptionId $receptionId, ContainerPayload $payload)
{
$command = new AddContainer($receptionId, $payload->temperature(), $payload->containerLines());
$this->commandBus->handle($command);
}
}
namespace UlaboxChangoDomainCommandReception;
class ReceptionCommandHandler extends CommandHandler
{
public function handleAddContainer(AddContainer $command)
{
$reception = $this->receptionRepository->get($command->aggregateId());
$reception->addContainer($command->temperature(), $command->lines());
$this->receptionRepository->save($reception);
$this->eventBus->dispatch($reception->recordedEvents());
}
}
26. namespace UlaboxChangoDomainReadModelReception;
class ReceptionProjector extends ReadModelProcessor
{
public function applyContainerWasAdded(ContainerWasAdded $event)
{
$reception = $this->receptionInfoView->receptionOfId($event->aggregateId());
$container = new ContainerProjection($event->containerId(), $event->temperature());
$this->receptionInfoView->save($reception->addContainer($container));
}
public function applyContainerLineWasAdded(ContainerLineWasAdded $event)
{
$reception = $this->receptionInfoView->receptionOfId($event->aggregateId());
$line = ContainerLineProjection($event->label(), $event->quantity(), $event->itemType());
$this->receptionInfoView->save($reception->addContainerLine($event->containerId(), $line));
}
}
namespace UlaboxChangoDomainReadModelReception;
interface ReceptionView
{
public function save(ReceptionProjection $reception);
public function receptionOfId(ReceptionId $receptionId);
public function find(Query $query);
}
27. namespace UlaboxChangoApplicationService;
class ReceptionQueryService
{
public function byId(ReceptionId $receptionId)
{
return $this->receptionView->receptionOfId($receptionId);
}
public function byContainer(ContainerId $containerId)
{
return $this->receptionView->find(new byContainer($containerId));
}
public function search($filters, Paging $paging = null, Sorting $sorting = null)
{
return $this->receptionView->find(new ByFilters($filters, $sorting, $paging));
}
}
29. When CQRS meets Event Sourcing / Event sourcing
Event sourcing
● Entities are reconstructed with events
● No state
● No database to update manually
● No joins
30. When CQRS meets Event Sourcing / Event sourcing
Why event sourcing?
● Get state of an aggregate at any moment in time
● Append-only model storing events is easier to scale
● Forces to log because everything is an event
● No coupling between current state in the domain and in storage
● Simulate business suppositions
○ Change picking algorithm
31. When CQRS meets Event Sourcing / Event sourcing
Event Store
● PostgreSQL
● jsonb
● DBAL
32. namespace UlaboxChangoInfrastructurePersistenceEventStore;
class PDOEventStore implements EventStore
{
public function append(AggregateId $id, EventStream $eventStream)
{
$stmt = $this->connection->prepare("INSERT INTO event_store (data) VALUES (:message)");
$this->connection->beginTransaction();
foreach ($eventStream as $event) {
if (!$stmt->execute(['message' => $this->eventSerializer->serialize($event)])) {
$this->connection->rollBack();
}
}
$this->connection->commit();
}
public function load(AggregateId $id)
{
$stmt = $this->connection->prepare("SELECT data FROM event_store WHERE data->'payload'->>'aggregate_id' = :id");
$stmt->execute(['id' => (string) $id]);
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$events = [];
foreach ($rows as $row) {
$events[] = $this->eventSerializer->deserialize($row['data']);
}
return new EventStream($events);
}
}
39. When CQRS meets Event Sourcing / Conclusions
Benefits
● Decoupling
● Performance in Read Model
● Scalability
● No joins
● Async with internal events and consumers
● Communicate other bounded contexts with events
40. When CQRS meets Event Sourcing / Conclusions
Problems found
● With DDD
○ Decide aggregates => talk a LOT with the domain experts
○ Boilerplate => generate as much boilerplate as possible
● With CQRS
○ Forgetting listeners in read model
○ Repeated code structure
● With event sourcing
○ Adapting your mindset
○ Forgetting applying the event to the entity
○ Retro compatibility with old events
● Concurrency/eventual consistency