In building large scale web applications MVC seems like a good solution in the initial design phase. However after having built a few large apps that have multiple entry points (web, cli, api etc) you start to find that MVC breaks down. Start using Domain Driven Design.
Domain-driven design (DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model.[1] The premise of domain-driven design is the following:
Placing the project's primary focus on the core domain and domain logic.
Basing complex designs on a model of the domain.
Initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems.
Have more questions?
Twitter: @wajrcs
Web: http://waqaralamgir.tk
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/
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.
HHVM is a virtual machine for executing PHP code designed to be faster than traditional PHP implementations. It uses just-in-time (JIT) compilation to convert PHP bytecode into machine-optimized code during execution. This allows HHVM to approach the performance of C/C++ applications. It is open source software developed by Facebook as a drop-in replacement for PHP that can boost performance for popular PHP frameworks and applications.
Back to the basics: Modelando nuestro dominio #scbcn19CodelyTV
SOLID, Arquitectura Hexagonal, CQRS, DDD… total, que llega el momento de modelar nuestras entidades y servicios, y nos hacemos un lío que no sabemos ni por dónde empezar .
Sensación de bloqueo. ""Hostia, llevo 3 horas pensando y dibujando posibles alternativas y ninguna me convence. Al final será verdad que no tengo ni idea "".
Planteamos hipótesis erróneas del estilo… _si lo hago con DDD ""de verdad"" la query no aguanta ni 100 peticiones concurrentes, pero esto otro me parece una chapuza, y esto otro viola 7 de los 5 principios SOLID… ¡¡¡mmmmmamaaaaaa!!! ._
Keep calm.
En esta charla plantearemos distintos escenarios prácticos y reales. Casos de uso de esos que se pueden ver en un screenshot y donde la gran mayoría de desarrolladores web y móviles nos podemos ver identificados:
* Listado de items con 652342 filtros y combinatorias (backoffices, páginas de categoría o filtrados, búsquedas…)
* Tipologías de items con partes comunes pero pequeños matices (productos de distintas categorías por ejemplo)
* Distintas opciones a la hora de modelar nuestras interfaces para hacerlas realmente agnósticas de la infraestructura que hay detrás
En fin. Cositas que nos han supuesto un reto a la hora de plantearlas, que hemos fallado modelando y hasta que no lo hemos tenido picado no nos hemos dado cuenta de la magnitud de la tragedia, y batallitas que ojalá puedan serle útiles a alguien
This document discusses various programming concepts and techniques including:
- Object oriented design and whether it makes programming more enjoyable
- Techniques for working with dates like DateTime parsing and date arithmetic
- Addressing anemic domain models by adding behavior to entities
- Different approaches to application architecture like repositories, services, and the unit of work pattern
- Best practices for testing like focusing tests on behavior rather than implementation details
- Principles like abstraction, the story of the code, and only coding what is needed
In building large scale web applications MVC seems like a good solution in the initial design phase. However after having built a few large apps that have multiple entry points (web, cli, api etc) you start to find that MVC breaks down. Start using Domain Driven Design.
Domain-driven design (DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model.[1] The premise of domain-driven design is the following:
Placing the project's primary focus on the core domain and domain logic.
Basing complex designs on a model of the domain.
Initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems.
Have more questions?
Twitter: @wajrcs
Web: http://waqaralamgir.tk
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/
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.
HHVM is a virtual machine for executing PHP code designed to be faster than traditional PHP implementations. It uses just-in-time (JIT) compilation to convert PHP bytecode into machine-optimized code during execution. This allows HHVM to approach the performance of C/C++ applications. It is open source software developed by Facebook as a drop-in replacement for PHP that can boost performance for popular PHP frameworks and applications.
Back to the basics: Modelando nuestro dominio #scbcn19CodelyTV
SOLID, Arquitectura Hexagonal, CQRS, DDD… total, que llega el momento de modelar nuestras entidades y servicios, y nos hacemos un lío que no sabemos ni por dónde empezar .
Sensación de bloqueo. ""Hostia, llevo 3 horas pensando y dibujando posibles alternativas y ninguna me convence. Al final será verdad que no tengo ni idea "".
Planteamos hipótesis erróneas del estilo… _si lo hago con DDD ""de verdad"" la query no aguanta ni 100 peticiones concurrentes, pero esto otro me parece una chapuza, y esto otro viola 7 de los 5 principios SOLID… ¡¡¡mmmmmamaaaaaa!!! ._
Keep calm.
En esta charla plantearemos distintos escenarios prácticos y reales. Casos de uso de esos que se pueden ver en un screenshot y donde la gran mayoría de desarrolladores web y móviles nos podemos ver identificados:
* Listado de items con 652342 filtros y combinatorias (backoffices, páginas de categoría o filtrados, búsquedas…)
* Tipologías de items con partes comunes pero pequeños matices (productos de distintas categorías por ejemplo)
* Distintas opciones a la hora de modelar nuestras interfaces para hacerlas realmente agnósticas de la infraestructura que hay detrás
En fin. Cositas que nos han supuesto un reto a la hora de plantearlas, que hemos fallado modelando y hasta que no lo hemos tenido picado no nos hemos dado cuenta de la magnitud de la tragedia, y batallitas que ojalá puedan serle útiles a alguien
This document discusses various programming concepts and techniques including:
- Object oriented design and whether it makes programming more enjoyable
- Techniques for working with dates like DateTime parsing and date arithmetic
- Addressing anemic domain models by adding behavior to entities
- Different approaches to application architecture like repositories, services, and the unit of work pattern
- Best practices for testing like focusing tests on behavior rather than implementation details
- Principles like abstraction, the story of the code, and only coding what is needed
Towards Functional Programming through Hexagonal ArchitectureCodelyTV
Slides of for the talk "Towards Functional Programming through Hexagonal Architecture" delivered at the Software Crafters Barcelona 2018 conference #scbcn18 by Juanma Serrano from Habla Computing and Javier Ferrer from CodelyTV
This document provides an overview and introduction to phpspec, an open source BDD framework for PHP. It covers installing phpspec, generating and editing specs, running specs, different types of matchers for specs including identity, comparison, throw, type and object state matchers. It also briefly mentions formatters, progress reporting, stubbing, mocking and points to additional resources.
This document discusses dependency injection smells in PHP code from frameworks like Zend, Symfony, and Doctrine. It identifies common anti-patterns like static dependencies, missing dependency auto-recovery, hidden dependencies, creation logic reduction, factory methods, programming against implementations, and prohibiting dependencies. The document provides examples of these smells and recommends refactoring approaches, emphasizing that dependencies should be explicit, only required minimum dependencies injected, and API design consider the needs of users.
The document discusses Test Driven Development (TDD) using PhpSpec. It begins with an overview of TDD vs Behavior Driven Development (BDD). It then covers key aspects of using PhpSpec including describing object behavior with examples, verifying behavior by running tests, matchers for assertions, describing collaborations and exceptions. The rest of the document demonstrates a TDD workflow using PhpSpec to develop a greeter class and related classes like Person in a step-by-step manner.
This document discusses entities in Drupal 8. It explains that taxonomy vocabularies, roles, and node types are now configuration entities, while nodes remain content entities. Entities now implement the EntityInterface and either the ContentEntityInterface or ConfigEntityInterface. Fields are now separated from entities and are configuration objects that can work on non-configurable fields. The document outlines remaining work like unifying the field and entity APIs.
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswanivvaswani
Explains how to use the Slim PHP micro-framework to quickly deploy a REST API. Includes sample code to implement common API requirements, such as authentication, request logging and multi-format support.
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
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Arc & Codementor
The document discusses modern PHP features such as exceptions, namespaces, closures, statics, short array syntax, PDO, security improvements, and popular PHP tools. It provides examples of how to use exceptions, closures, namespaces, statics, short array syntax, PDO, and security features. It also introduces the built-in PHP web server, Composer package manager, and PHPUnit testing framework as useful modern PHP tools.
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceIvan Chepurnyi
It is a pity, but I have to admit, that Magento 2 has issues in layout generation process. You'll learn during the talk about the benefits of compiling XML structures into PHP code, and even use the compilation of PHP code into PHP code to speed up your modules complex logic.
PhpSpec is a SpecBDD tool that enables you to use a TDD workflow that can transform the way you write PHP. In this session we will look at the TDD workflow and see how PhpSpec can be used to speed up your development; add regression safety, and improve your object-oriented design.
This document discusses PHPSpec, a behavior-driven development (BDD) framework for PHP. It begins by explaining what PHPSpec is and how it implements BDD through a domain-specific language (DSL) based on RSpec. The document then covers how PHPSpec specifies tests using contexts, examples, expectations, matchers, mocks, and stubs. It provides examples of writing PHPSpec tests and using various PHPSpec features. The document concludes by mentioning upcoming PHPSpec features and linking to resources for learning more.
This document provides an overview of the basics of Drupal module development, including how to create blocks, forms, menus, and send emails using Drupal hooks and APIs. It demonstrates building a simple "DrupalCamp Forward" module that allows users to forward node URLs to friends. Key aspects covered include defining modules with .info and .module files, implementing common hooks for blocks, permissions, forms, and menus, and performing actions like form validation, form submission, and sending emails. The goal is to teach beginners the fundamentals of the Drupal API and module development.
All projects start with a lot of enthusiasm. As many projects grow the technical debt gets bigger and the enthusiasm gets less. Almost any developer can develop a great project, but the key is maintaining an ever evolving application with minimal technical debt without loosing enthusiasm.
During this talk you will be taken on the journey of application design. The starting point is an application that looks fine but contains lots of potential pitfalls. We will address the problems and solve them with beautiful design. We end up with testable, nicely separated software with a clear intention.
Given at TrueNorthPHP 2014:
"MVC presents a great way to divide responsibilities in your application but it offers no help in building the most critical part: the model or domain. This talk will introduce ways that can help you to encapsulate the richness of your domain. We'll look at Action Domain Response as a new way of thinking about the concepts presented in MVC before examining Hexagonal Architecture, allowing you to easily reuse your domain across multiple delivery mechanisms. We'll then finish with an introduction to Domain Driven Design, a technique that allows you to closely align your domain with the business problems it is solving while helping keep things well designed and easily maintainable. By the end of this talk you should have the knowledge needed to begin modelling your domains more powerfully while keeping them aligned to the real world problems they solve."
This document provides an overview of test-driven development (TDD) using the phpspec2 framework. It discusses the different types of tests - functional tests using phpunit or behat, integration tests with PHPUnit, and unit tests with phpspec. It provides examples of writing unit tests with phpspec, including using matchers, mocks, predictions, and advanced features like array mocks. It also offers best practices advice, such as not mocking 3rd party code and considering dependency injection libraries that are well-suited for TDD.
This document discusses dependency injection with PHP 5.3. It provides a real world example of managing user preferences like language and authentication status with a User object. By injecting the storage dependency via the constructor rather than hardcoding it, different storage strategies can be used easily and the code is more customizable and testable. The document advocates using a dependency injection container to configure parameters and manage object instantiation and dependencies.
PHP frameworks provide reusable code and standardized structures for developing applications. The Zend framework is a popular open source PHP MVC framework that offers features like database abstraction, forms, validation, routing and more. It provides a modular architecture that allows applications to scale easily while maintaining code quality and organization.
AngularJS with Slim PHP Micro FrameworkBackand Cohen
AngularJS is a popular front-end framework that can be used with many server-side technologies. In many AngularJS web applications, each web page is really a single-page application (SPA), so the role of the server-side is really an API consisting of a set of web services to interact with the server-side database
PHP7 brings a tremendous number of new features. Tonight, we will take a look at the null coalesce operator, new execution order (uniform variable syntax), new exceptions and more.
This document discusses using CodeIgniter hooks to implement access control lists (ACL) for authorization instead of hardcoding checks in controllers. It describes how to define a pre_controller hook that checks user permissions against defined roles and redirects unauthorized users. An Accesscheck class and permissions array centralize the ACL logic, allowing role-based access control without modifying core files. This provides a simpler, more flexible alternative to ACL implementations in other frameworks.
This document provides an overview of key concepts in Domain-Driven Design (DDD) including the ubiquitous language, bounded contexts, value objects, entities, repositories, collections, mappers, identity maps, units of work, and services. It explains that DDD is a set of principles and patterns that help developers create elegant systems by focusing on the core domain and language of the business. It also emphasizes separating business processes into bounded contexts and using ubiquitous language consistently throughout the code.
The slides of my talk at PUGRoma.
Here, a complete sample code
https://github.com/leopro/trip-planner
Presentation is also here: http://t.co/5EK56yYBmQ
Towards Functional Programming through Hexagonal ArchitectureCodelyTV
Slides of for the talk "Towards Functional Programming through Hexagonal Architecture" delivered at the Software Crafters Barcelona 2018 conference #scbcn18 by Juanma Serrano from Habla Computing and Javier Ferrer from CodelyTV
This document provides an overview and introduction to phpspec, an open source BDD framework for PHP. It covers installing phpspec, generating and editing specs, running specs, different types of matchers for specs including identity, comparison, throw, type and object state matchers. It also briefly mentions formatters, progress reporting, stubbing, mocking and points to additional resources.
This document discusses dependency injection smells in PHP code from frameworks like Zend, Symfony, and Doctrine. It identifies common anti-patterns like static dependencies, missing dependency auto-recovery, hidden dependencies, creation logic reduction, factory methods, programming against implementations, and prohibiting dependencies. The document provides examples of these smells and recommends refactoring approaches, emphasizing that dependencies should be explicit, only required minimum dependencies injected, and API design consider the needs of users.
The document discusses Test Driven Development (TDD) using PhpSpec. It begins with an overview of TDD vs Behavior Driven Development (BDD). It then covers key aspects of using PhpSpec including describing object behavior with examples, verifying behavior by running tests, matchers for assertions, describing collaborations and exceptions. The rest of the document demonstrates a TDD workflow using PhpSpec to develop a greeter class and related classes like Person in a step-by-step manner.
This document discusses entities in Drupal 8. It explains that taxonomy vocabularies, roles, and node types are now configuration entities, while nodes remain content entities. Entities now implement the EntityInterface and either the ContentEntityInterface or ConfigEntityInterface. Fields are now separated from entities and are configuration objects that can work on non-configurable fields. The document outlines remaining work like unifying the field and entity APIs.
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswanivvaswani
Explains how to use the Slim PHP micro-framework to quickly deploy a REST API. Includes sample code to implement common API requirements, such as authentication, request logging and multi-format support.
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
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Arc & Codementor
The document discusses modern PHP features such as exceptions, namespaces, closures, statics, short array syntax, PDO, security improvements, and popular PHP tools. It provides examples of how to use exceptions, closures, namespaces, statics, short array syntax, PDO, and security features. It also introduces the built-in PHP web server, Composer package manager, and PHPUnit testing framework as useful modern PHP tools.
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceIvan Chepurnyi
It is a pity, but I have to admit, that Magento 2 has issues in layout generation process. You'll learn during the talk about the benefits of compiling XML structures into PHP code, and even use the compilation of PHP code into PHP code to speed up your modules complex logic.
PhpSpec is a SpecBDD tool that enables you to use a TDD workflow that can transform the way you write PHP. In this session we will look at the TDD workflow and see how PhpSpec can be used to speed up your development; add regression safety, and improve your object-oriented design.
This document discusses PHPSpec, a behavior-driven development (BDD) framework for PHP. It begins by explaining what PHPSpec is and how it implements BDD through a domain-specific language (DSL) based on RSpec. The document then covers how PHPSpec specifies tests using contexts, examples, expectations, matchers, mocks, and stubs. It provides examples of writing PHPSpec tests and using various PHPSpec features. The document concludes by mentioning upcoming PHPSpec features and linking to resources for learning more.
This document provides an overview of the basics of Drupal module development, including how to create blocks, forms, menus, and send emails using Drupal hooks and APIs. It demonstrates building a simple "DrupalCamp Forward" module that allows users to forward node URLs to friends. Key aspects covered include defining modules with .info and .module files, implementing common hooks for blocks, permissions, forms, and menus, and performing actions like form validation, form submission, and sending emails. The goal is to teach beginners the fundamentals of the Drupal API and module development.
All projects start with a lot of enthusiasm. As many projects grow the technical debt gets bigger and the enthusiasm gets less. Almost any developer can develop a great project, but the key is maintaining an ever evolving application with minimal technical debt without loosing enthusiasm.
During this talk you will be taken on the journey of application design. The starting point is an application that looks fine but contains lots of potential pitfalls. We will address the problems and solve them with beautiful design. We end up with testable, nicely separated software with a clear intention.
Given at TrueNorthPHP 2014:
"MVC presents a great way to divide responsibilities in your application but it offers no help in building the most critical part: the model or domain. This talk will introduce ways that can help you to encapsulate the richness of your domain. We'll look at Action Domain Response as a new way of thinking about the concepts presented in MVC before examining Hexagonal Architecture, allowing you to easily reuse your domain across multiple delivery mechanisms. We'll then finish with an introduction to Domain Driven Design, a technique that allows you to closely align your domain with the business problems it is solving while helping keep things well designed and easily maintainable. By the end of this talk you should have the knowledge needed to begin modelling your domains more powerfully while keeping them aligned to the real world problems they solve."
This document provides an overview of test-driven development (TDD) using the phpspec2 framework. It discusses the different types of tests - functional tests using phpunit or behat, integration tests with PHPUnit, and unit tests with phpspec. It provides examples of writing unit tests with phpspec, including using matchers, mocks, predictions, and advanced features like array mocks. It also offers best practices advice, such as not mocking 3rd party code and considering dependency injection libraries that are well-suited for TDD.
This document discusses dependency injection with PHP 5.3. It provides a real world example of managing user preferences like language and authentication status with a User object. By injecting the storage dependency via the constructor rather than hardcoding it, different storage strategies can be used easily and the code is more customizable and testable. The document advocates using a dependency injection container to configure parameters and manage object instantiation and dependencies.
PHP frameworks provide reusable code and standardized structures for developing applications. The Zend framework is a popular open source PHP MVC framework that offers features like database abstraction, forms, validation, routing and more. It provides a modular architecture that allows applications to scale easily while maintaining code quality and organization.
AngularJS with Slim PHP Micro FrameworkBackand Cohen
AngularJS is a popular front-end framework that can be used with many server-side technologies. In many AngularJS web applications, each web page is really a single-page application (SPA), so the role of the server-side is really an API consisting of a set of web services to interact with the server-side database
PHP7 brings a tremendous number of new features. Tonight, we will take a look at the null coalesce operator, new execution order (uniform variable syntax), new exceptions and more.
This document discusses using CodeIgniter hooks to implement access control lists (ACL) for authorization instead of hardcoding checks in controllers. It describes how to define a pre_controller hook that checks user permissions against defined roles and redirects unauthorized users. An Accesscheck class and permissions array centralize the ACL logic, allowing role-based access control without modifying core files. This provides a simpler, more flexible alternative to ACL implementations in other frameworks.
This document provides an overview of key concepts in Domain-Driven Design (DDD) including the ubiquitous language, bounded contexts, value objects, entities, repositories, collections, mappers, identity maps, units of work, and services. It explains that DDD is a set of principles and patterns that help developers create elegant systems by focusing on the core domain and language of the business. It also emphasizes separating business processes into bounded contexts and using ubiquitous language consistently throughout the code.
The slides of my talk at PUGRoma.
Here, a complete sample code
https://github.com/leopro/trip-planner
Presentation is also here: http://t.co/5EK56yYBmQ
The document discusses separating business logic from frameworks in application development. It introduces the hexagonal architecture pattern, which places the business logic at the center within its own domain layer. This separates it from interfaces to external systems like databases, web servers, and frameworks. The business logic focuses on modeling real-world entities and rules within the domain layer. External interfaces are handled by separate ports and adapter classes that interface with but do not depend on the specific persistence or web implementation layers. Examples of implementing this pattern for a shopping cart application are shown, with domain models, repositories, and services.
Using HttpKernelInterface for Painless IntegrationCiaranMcNulty
In this short session we will look at one of the Symfony2 components adopted since Drupal 8; the HttpKernelInterface.
Attendees will gain familiarity with this component, the related Request and Response objects, and the overall top level structure of a Drupal 8 project's integration.
We will also see how the Stack PHP project allows us to easily integrate a Drupal 8 site with another codebase that uses the HttpKernelInterface (including Symfony2, Silex, Laravel or even another Drupal 8 project).
We will also explore some of the other functionality that can be added by Stack, all enabled by this powerful abstraction.
This document discusses various techniques for scaling web applications, including horizontal scaling by adding more servers behind a load balancer, using a session store like Redis for shared sessions, centralized logging, and continuous integration to deploy updates. It also covers load balancing with HAProxy, monitoring with Zabbix, caching with Varnish, database scaling with master-slave replication or sharding in MongoDB, and using queues like RabbitMQ. The key is to think of the application as independent workers that can run on multiple servers rather than a single instance.
The document discusses domain-driven design concepts such as domain models, entities, value objects, repositories, and services. It provides examples of how to model an IP address as a value object and a user as an entity. It emphasizes that domain models express the core domain concepts and that business logic should not be placed in controllers or entities, but rather in services and repositories.
This document discusses Node.js architecture and how software lives in hardware. It notes that Node.js uses a single-threaded, event loop model to avoid context switching and blocking I/O. This allows high throughput for operations like HTTP requests but is not optimal for long-running computations in a single thread. The document also addresses issues like callback hell and scaling event emitters, providing solutions like using promises and external queue systems. It concludes by stating Node.js is best for I/O operations, not all problems, and event loop models have existed in other frameworks before Node.js.
A Visual Introduction to Event Sourcing and CQRS by Lorenzo NicoraOpenCredo
Slides from Lorenzo's speech at Haufe-Lexware Microservice Architecture Day, in Freiburg. A pictorial introduction to the concepts of Command and Event Sourcing, and CQRS, as persistence model for modern, scalable and distributed applications.
Domain Driven Design (DDD) is a software design approach that focuses on modeling a domain accurately. It uses ubiquitous language, bounded contexts, and explicit domain models. The key aspects of DDD include developing a shared model with domain experts, separating concerns into bounded contexts, and iteratively refining domain models through close collaboration between technical and domain teams. DDD aims to produce software designs that are more aligned with the mental models of users and stakeholders in a complex domain.
Developing event-driven microservices with event sourcing and CQRS (phillyete)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 Separation (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.
The document discusses hexagonal architecture and how it can be applied to PHP applications. It begins by defining software architecture and its importance. It then explains hexagonal architecture, which separates an application into distinct layers including domain, application, and infrastructure layers. The layers are decoupled via defined boundaries and interfaces. Commands are used to communicate between layers and are handled by command buses and handlers. Examples are given of implementing repositories, commands and handlers to follow this pattern in a PHP application.
Domain-driven design (DDD) is a software development approach that focuses on the core domain and business logic. It proposes a ubiquitous language between business experts and developers. DDD is useful for complex domains with many business rules and an iterative development process. It aims to produce software that is flexible, extensible and has testable code agreed upon by domain experts and developers. Key aspects of DDD include modeling the domain using entities, value objects, aggregates and repositories. Other patterns like factories, services and commands can also be used. CQRS separates reads from writes for flexibility and performance. Frameworks like ORM, dependency injection and UUIDs can help implement DDD in PHP applications.
The document discusses dependency injection (DI) in PHP. It provides an overview of common DI containers and frameworks used in PHP projects, including Pimple, Bucket, Zend\Di, and Symfony. For each option, it demonstrates basic usage including constructor injection, setter injection, and retrieving services from the container. It also discusses concepts like shared services, configuration via XML, and injecting dependencies via interfaces or properties. The document serves as a high-level introduction to dependency injection in PHP.
DDD on example of Symfony (Webcamp Odessa 2014)Oleg Zinchenko
This document discusses Domain-Driven Design (DDD) patterns and principles using PHP and the Symfony framework as examples. It introduces key DDD concepts like the domain model, repositories, value objects, and strategies. It also outlines common layer structures and provides references to additional DDD resources.
This document provides an overview and introduction to Laravel 5, a PHP web application framework. It discusses key Laravel 5 concepts and features such as Eloquent ORM, routing, middleware, contracts, form requests, the IoC container, file drivers, scheduling commands, and the command bus pattern. The document is intended to explain Laravel 5 concepts through code examples and brief explanations.
So S.O.L.I.D Fu - Designing Better CodeNeil Crookes
A chat about some of the most important principles in software development. Discover or get a refresher on these tried and tested techniques for designing better code.
Code: https://github.com/neilcrookes/SoSOLIDFu/
This document discusses the history and current state of dependency injection (DI) in PHP. It provides an overview of DI principles and frameworks that have supported DI over the years such as Spring Framework, Symfony, and Zend Framework. The document then demonstrates how to implement DI using the Zend\Di and Symfony containers through examples of constructor injection, setter injection, interface injection and more.
Practical tips for dealing with projects involving legacy code. Covers investigating past projects, static analysis of existing code, and methods for changing legacy code.
Presented at PHP Benelux '10
The document discusses different software architectural patterns for managing complexity in web applications. It begins by explaining model-view-controller (MVC) and some of its limitations. It then introduces Action Domain Responder (ADR) as a refinement of MVC that maps more closely to the lifecycle of a web request. Next, it covers hexagonal architecture, also known as ports and adapters, which isolates an application from its inputs and outputs. Finally, it provides an overview of domain-driven design (DDD), including architectural patterns like bounded contexts and object patterns like entities, value objects, domain services, aggregates, and repositories.
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег ЗинченкоGeeksLab Odessa
DDD in PHP on example of Symfony
Олег Зинченко
В докладе речь пойдет о том, что такое DDD и почему MVC годами вводит нас в заблуждение. Как автор пришёл к мысли о том, что просто писать структурированный код недостаточно. Будут описаны слои приложения DDD, как они взаимодействуют между собой. Какие архитектурные паттерны стоят за DDD и почему они облегчают жизнь разработчика. Когда лучше использовать DDD, какие достоинства и недостатки есть у этого подхода. Примеры использованиея DDD подхода в Symfony приложениях.
Framework agnostic application Will it fit with Symfony? - Symfony live warsa...Dariusz Drobisz
Frameworks are great tools. And Symfony is my beloved one. A lot of developers learn from them how to write applications nowadays. But framework documentation shows you framework approach. There is nothing wrong, as it’s framework documentation job. Unfortunately, a lot of developers don’t look for any other architecture approaches. They stick with what they have seen in framework documentation.
During this talk, you will see how the application and domain layers could look in a framework-agnostic approach. Usage of ports and adapters architecture will help us with that. What is more interesting, it's easy to integrate application decoupled from the framework with that kind of tool. You will see that on an example of Symfony. And from the time that we have Symfony Flex on board, it’s even easier in that case.
The document discusses domain-driven design and how it can be used for strategic software improvement through relentless refactoring. It advocates separating the domain model from infrastructure concerns, using precise language to define domain concepts, and modeling complex behavior in bounded contexts. This allows software to better capture business domain rules and relationships, reducing duplication and improving maintainability through a richer model.
Everyone talks about raising the bar on the quality of code, but it’s hard to implement when you have no clue where to start. This talk is geared toward all levels of developers, and will teach you how to improve by using the right tools effectively – a must-attend for any PHP developer who wants to scale up their quality.
Michelangelo will tell us about Quality Assurance for PHP in general and show how different QA-related actions can be performed using PhpStorm IDE. The webinar will cover topics including:
Revision control
Syntax checking
Code documentation
Unit Testing with PHPUnit
Measuring code health with a variety of tools
Profiling and debugging with Xdebug
Automation with Phing
Team work and more.
Wojciech Sznapka presents key principles for achieving wise architecture with Symfony2:
1. Follow SOLID principles - each component should have a single responsibility and dependencies should be injected through interfaces.
2. Prioritize maintainability - thoroughly test code and implement logging.
3. Design for scalability - avoid dependencies on local storage, scale the database, and optimize for horizontal scaling.
Wise architecture is achieved by following best practices, leveraging existing bundles, and ensuring the application can be easily maintained and scaled over time.
This document discusses dependency injection in Drupal 8. It begins by explaining the problems with Drupal 7 code, such as strong dependencies on globals and an inability to reuse or test code easily. It then introduces dependency injection as a design pattern that can help address these issues by reducing hard-coded dependencies. The document outlines how dependency injection works in Symfony and will work in Drupal 8 through the use of a service container that allows injecting dependencies into classes.
How to improve your code quality? The answer is continuous refactoring. Learn more about refactoring. Know the most frequent code smells (antipatterns), telling when to refactor. Go through the catalog of well-known refactorings, telling how to improve your code.
The document discusses different architectural patterns for structuring business logic, including transaction script, active record, domain model, and event sourced domain model. It also covers related topics like layered architecture, testing strategies, programming languages, and choosing the right pattern based on factors like complexity of business logic and data structures. The goal is to select a pattern that best matches the needs of the specific business domain and application.
I present four design patterns that make your development easier and better. Design patterns are a fantastic way to make more readable code, as they make use of common ideas that many developers know and use. These patterns are tried and tested in the enterprise world.
The first one is dependency injection. This covers putting the variables that a class needs to function preferably inside a constructor.
The second one is the factory pattern. A factory moves the responsibility of instantiating an object to a third-party class.
The third one is dependency injection. This allows us to place a class' dependencies at one time, making it easy to come back and see what the class needs to survive.
Finally, we discuss the chain of responsibility. This allows complex operations to be handled by a chain of classes. Each class in the chain determines whether it is capable of handling the request and, if so, it returns the result.
Supercharging WordPress Development in 2018Adam Tomat
Slide links:
- PHP-FIG: https://www.php-fig.org/psr
- Timber: https://www.upstatement.com/timber/
- Bedrock: https://roots.io/bedrock/
- Lumberjack: https://github.com/Rareloop/lumberjack
- Lumberjack Core: https://github.com/Rareloop/lumberjack-core
- Collections: https://laravel.com/docs/5.6/collections
- PHP-DI: http://php-di.org/
- Lumberjack Validation: https://github.com/Rareloop/lumberjack-validation
- Sessions: https://github.com/Rareloop/lumberjack-core/tree/ft-session
- Lumberjack Example Repo: https://github.com/Rareloop/lumberjack-example
- Laravel Responsable: https://laravel-news.com/laravel-5-5-responsable
Towards the end of 2015 Rareloop launched their WordPress starter theme Lumberjack, which built on open source tools such as Bedrock and Timber. We wanted to move Lumberjack forward inline with everything we have learnt over the years of using it - which meant completely re-writing it from the ground up. The new Lumberjack is now stable and ready for use!
This talk is aimed at anyone involved in working with WordPress, regardless of how technical you are. The beauty of Lumberjack is that you can use as much or as little as you like, so whether you’re new to web development or a seasoned software engineer there will be something here for you.
Similaire à Domain-driven Design in PHP and Symfony - Drupal Camp Wroclaw! (20)
OmniFocus - the #1 ‘Getting Things Done’ toolKacper Gunia
OmniFocus is a task management software and the #1 tool for implementing Getting Things Done (GTD), a time management method. It allows users to collect tasks from any source or device, process tasks into actionable next steps, organize tasks into projects and contexts, and review and complete tasks. OmniFocus makes it easy to keep an inbox at zero, filter views by projects and contexts, and effectively manage tasks to get things done.
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupKacper Gunia
Slides from my talk at Symfony UK Meetup. London, 20 Aug 2014. http://twitter.com/cakper
Video: https://www.youtube.com/watch?v=cha92Og9M5A
More Domain-Driven Design related content at: https://domaincentric.net/
November Camp - Spec BDD with PHPSpec 2Kacper Gunia
My slides on PHPSpec 2 from Symfony November Camp Stockholm.
www.symfony.se/november-camp/
More Domain-Driven Design related content at: https://domaincentric.net/
The document discusses Behavior Driven Development (BDD) and testing in PHP. It introduces BDD and some common problems in testing like how to test dependencies. It then discusses tools for PHP testing like PHPUnit and PHP Spec 2. PHP Spec 2 is presented as a BDD framework for PHP that makes testing easy with matchers, test doubles and a TDD cycle approach. Examples are provided of how to write tests in PHP Spec 2.
Batteries -Introduction – Types of Batteries – discharging and charging of battery - characteristics of battery –battery rating- various tests on battery- – Primary battery: silver button cell- Secondary battery :Ni-Cd battery-modern battery: lithium ion battery-maintenance of batteries-choices of batteries for electric vehicle applications.
Fuel Cells: Introduction- importance and classification of fuel cells - description, principle, components, applications of fuel cells: H2-O2 fuel cell, alkaline fuel cell, molten carbonate fuel cell and direct methanol fuel cells.
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...IJECEIAES
Climate change's impact on the planet forced the United Nations and governments to promote green energies and electric transportation. The deployments of photovoltaic (PV) and electric vehicle (EV) systems gained stronger momentum due to their numerous advantages over fossil fuel types. The advantages go beyond sustainability to reach financial support and stability. The work in this paper introduces the hybrid system between PV and EV to support industrial and commercial plants. This paper covers the theoretical framework of the proposed hybrid system including the required equation to complete the cost analysis when PV and EV are present. In addition, the proposed design diagram which sets the priorities and requirements of the system is presented. The proposed approach allows setup to advance their power stability, especially during power outages. The presented information supports researchers and plant owners to complete the necessary analysis while promoting the deployment of clean energy. The result of a case study that represents a dairy milk farmer supports the theoretical works and highlights its advanced benefits to existing plants. The short return on investment of the proposed approach supports the paper's novelty approach for the sustainable electrical system. In addition, the proposed system allows for an isolated power setup without the need for a transmission line which enhances the safety of the electrical network
Comparative analysis between traditional aquaponics and reconstructed aquapon...bijceesjournal
The aquaponic system of planting is a method that does not require soil usage. It is a method that only needs water, fish, lava rocks (a substitute for soil), and plants. Aquaponic systems are sustainable and environmentally friendly. Its use not only helps to plant in small spaces but also helps reduce artificial chemical use and minimizes excess water use, as aquaponics consumes 90% less water than soil-based gardening. The study applied a descriptive and experimental design to assess and compare conventional and reconstructed aquaponic methods for reproducing tomatoes. The researchers created an observation checklist to determine the significant factors of the study. The study aims to determine the significant difference between traditional aquaponics and reconstructed aquaponics systems propagating tomatoes in terms of height, weight, girth, and number of fruits. The reconstructed aquaponics system’s higher growth yield results in a much more nourished crop than the traditional aquaponics system. It is superior in its number of fruits, height, weight, and girth measurement. Moreover, the reconstructed aquaponics system is proven to eliminate all the hindrances present in the traditional aquaponics system, which are overcrowding of fish, algae growth, pest problems, contaminated water, and dead fish.
Design and optimization of ion propulsion dronebjmsejournal
Electric propulsion technology is widely used in many kinds of vehicles in recent years, and aircrafts are no exception. Technically, UAVs are electrically propelled but tend to produce a significant amount of noise and vibrations. Ion propulsion technology for drones is a potential solution to this problem. Ion propulsion technology is proven to be feasible in the earth’s atmosphere. The study presented in this article shows the design of EHD thrusters and power supply for ion propulsion drones along with performance optimization of high-voltage power supply for endurance in earth’s atmosphere.
artificial intelligence and data science contents.pptxGauravCar
What is artificial intelligence? Artificial intelligence is the ability of a computer or computer-controlled robot to perform tasks that are commonly associated with the intellectual processes characteristic of humans, such as the ability to reason.
› ...
Artificial intelligence (AI) | Definitio
Software Engineering and Project Management - Introduction, Modeling Concepts...Prakhyath Rai
Introduction, Modeling Concepts and Class Modeling: What is Object orientation? What is OO development? OO Themes; Evidence for usefulness of OO development; OO modeling history. Modeling
as Design technique: Modeling, abstraction, The Three models. Class Modeling: Object and Class Concept, Link and associations concepts, Generalization and Inheritance, A sample class model, Navigation of class models, and UML diagrams
Building the Analysis Models: Requirement Analysis, Analysis Model Approaches, Data modeling Concepts, Object Oriented Analysis, Scenario-Based Modeling, Flow-Oriented Modeling, class Based Modeling, Creating a Behavioral Model.
Embedded machine learning-based road conditions and driving behavior monitoringIJECEIAES
Car accident rates have increased in recent years, resulting in losses in human lives, properties, and other financial costs. An embedded machine learning-based system is developed to address this critical issue. The system can monitor road conditions, detect driving patterns, and identify aggressive driving behaviors. The system is based on neural networks trained on a comprehensive dataset of driving events, driving styles, and road conditions. The system effectively detects potential risks and helps mitigate the frequency and impact of accidents. The primary goal is to ensure the safety of drivers and vehicles. Collecting data involved gathering information on three key road events: normal street and normal drive, speed bumps, circular yellow speed bumps, and three aggressive driving actions: sudden start, sudden stop, and sudden entry. The gathered data is processed and analyzed using a machine learning system designed for limited power and memory devices. The developed system resulted in 91.9% accuracy, 93.6% precision, and 92% recall. The achieved inference time on an Arduino Nano 33 BLE Sense with a 32-bit CPU running at 64 MHz is 34 ms and requires 2.6 kB peak RAM and 139.9 kB program flash memory, making it suitable for resource-constrained embedded systems.
36. class
Sale
{
(…)
private
$id;
!
function
__construct($name,
DateTimeInterface
$dueDate)
{
$this-‐>name
=
$name;
$this-‐>dueDate
=
$dueDate;
}
!
public
function
getId()
{
return
$this-‐>id;
}
}
37. class
Sale
{
(…)
public
function
activate()
{
if
(true
===
$this-‐>active)
{
throw
new
LogicException('Sale
already
activated!');
}
!
$this-‐>active
=
true;
}
}
39. class
Email
{
(…)
public
function
__construct($email)
{
if
(!filter_var($email,
FILTER_VALIDATE_EMAIL))
{
throw
new
InvalidArgumentException();
}
!
$this-‐>email
=
$email;
}
!
function
asString()
{
return
$this-‐>email;
}
}
43. interface
OrderRepository
{
public
function
save(Order
$order);
!
public
function
remove(Order
$order);
public
function
findById($orderId);
!
public
function
findObsolete();
}
44. class
DoctrineOrderRepository
implements
OrderRepository
{}
!
class
FileOrderRepository
implements
OrderRepository
{}
!
class
InMemoryOrderRepository
implements
OrderRepository
{}