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 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.
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 refactoring legacy PHP code, specifically dealing with code that has no separation between PHP and HTML. It recommends separating code into controllers and views by gathering all code, separating controller and view code, assigning variables to a view object, changing variable references in the view code, and splitting the files. Specific problems in legacy PHP code like no separation of concerns, global variables, and reliance on includes can be addressed through techniques like creating view classes, encapsulating logic in objects, and wrapping includes in functions to untangle dependency webs. The goal is to safely change code implementation without changing behavior through refactoring.
You must’ve heard of Unit testing… If not, then this talk is definitely for you! If you do know Unit testing, you probably ran at some point into a hurdle: “Where do I start?” And despite your best efforts, you end up not having enough tests for your application – Then that change request comes in, requiring you to change that very same complex piece of code for which you are lacking tests! How do you going refactor while maintaining all those ‘undocumented’ business rules? This talk will show how Codeception can be leveraged to refactor the visuals aspects of an application, maintaining backwards compatibility on API changes and even assist in moving to a whole different server infrastructure.
TDC2016SP - Trilha Developing for Businesstdc-globalcode
The document discusses PHP architecture for developing business applications. It covers topics like isolating business logic, using entities and value objects, implementing repositories, services and dependency injection. Code examples are provided to demonstrate structured PHP code with MVC patterns, unit testing, composer autoloading and configuring dependencies through a DI container.
Essa palestra foi feita no TDC 2016 na trilha de PHP Architecture onde a idéia principal é mostrar como aplicar boas práticas e organização de código para atender as necessidades do negócio com uso de uma linguagem simples e autoexplicativa.
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.
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 refactoring legacy PHP code, specifically dealing with code that has no separation between PHP and HTML. It recommends separating code into controllers and views by gathering all code, separating controller and view code, assigning variables to a view object, changing variable references in the view code, and splitting the files. Specific problems in legacy PHP code like no separation of concerns, global variables, and reliance on includes can be addressed through techniques like creating view classes, encapsulating logic in objects, and wrapping includes in functions to untangle dependency webs. The goal is to safely change code implementation without changing behavior through refactoring.
You must’ve heard of Unit testing… If not, then this talk is definitely for you! If you do know Unit testing, you probably ran at some point into a hurdle: “Where do I start?” And despite your best efforts, you end up not having enough tests for your application – Then that change request comes in, requiring you to change that very same complex piece of code for which you are lacking tests! How do you going refactor while maintaining all those ‘undocumented’ business rules? This talk will show how Codeception can be leveraged to refactor the visuals aspects of an application, maintaining backwards compatibility on API changes and even assist in moving to a whole different server infrastructure.
TDC2016SP - Trilha Developing for Businesstdc-globalcode
The document discusses PHP architecture for developing business applications. It covers topics like isolating business logic, using entities and value objects, implementing repositories, services and dependency injection. Code examples are provided to demonstrate structured PHP code with MVC patterns, unit testing, composer autoloading and configuring dependencies through a DI container.
Essa palestra foi feita no TDC 2016 na trilha de PHP Architecture onde a idéia principal é mostrar como aplicar boas práticas e organização de código para atender as necessidades do negócio com uso de uma linguagem simples e autoexplicativa.
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.
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/
PHPUnit is a test suite framework that is widely used for PHP projects. It provides improvements over older testing frameworks like SimpleTest, including better command line tools, code coverage reports, assertions, mock objects, and tool chain support. PHPUnit uses annotations and assertions to make tests stricter and more consistent. It supports features like fixtures, mock objects, and code coverage reporting to help test codebases thoroughly. PHPUnit can be run from the command line or a web interface, and integrates with continuous integration servers to run tests automatically.
This document summarizes a presentation on writing secure Drupal code. It discusses common vulnerabilities like cross-site scripting, access bypass, and SQL injection. It demonstrates how to securely code against these vulnerabilities and recommends using tools like Behat tests, security advisories, and contributing to Drupal to improve security. The presentation encourages writing secure code through sanitizing user input, using database placeholders, and following best practices.
The document discusses the SOLID principles of object-oriented design:
- The Single Responsibility Principle states that a class should have one, and only one, reason to change. An example class that violates this principle is refactored to separate concerns into distinct classes.
- The Open/Closed Principle states that a class should be open for extension but closed for modification. An encoder class is refactored to use polymorphism and dependency injection to follow this principle.
- The Liskov Substitution Principle states that subclasses must be substitutable for their base classes. Examples of violations include subclasses not implementing base class methods or having incompatible method signatures.
The document discusses the importance of unit testing and describes how developers are returning to write good tests after cutting corners during economic difficulties. It provides examples of unit tests being written for an order management system using PHPUnit to test the createOrder method by mocking dependencies and asserting the return value.
Building a Portfolio With Custom Post TypesAlex Blackie
This document discusses how to build a portfolio using WordPress custom post types. It provides code examples for creating a "Projects" custom post type and a "Clients" taxonomy. Template files are shown for displaying a portfolio listing page and single project pages. Features like post thumbnails are demonstrated. The custom post types allow organizing portfolio projects under client taxonomy terms in a flexible way.
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.
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/
Hacking Your Way To Better Security - Dutch PHP Conference 2016Colin O'Dell
The goal of this talk is to educate developers on common security vulnerabilities, how they are exploited, and how to protect against them. We'll explore several of the OWASP Top 10 attack vectors like SQL injection, XSS, CSRF, session hijacking, and insecure direct object references. Each topic will be approached from the perspective of an attacker to see how these vulnerabilities are detected and exploited using several realistic examples. Once we've established an understanding of how these attacks work, we'll look at concrete steps you can take to secure web applications against such vulnerabilities. The knowledge gained from this talk can also be used for participating in "Capture the Flag" security competitions.
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.
Performance and testing are just one aspect of code, to really be successful your code needs to be readable, maintainable and generally easier to comprehend and work with. This talk draws from my own experience in applying the techniques of object calisthenics and code readability, within an existing team. It will help you identify trouble areas, learn how to refactor them and train you to write better code in future projects avoiding common pitfalls.
The document discusses the SOLID principles of object-oriented design, which are Single Responsibility Principle, Open Closed Principle, Liskov Substitution Principle, Interface Segregation Principle, and Dependency Inversion Principle. For each principle, it provides an example of how to apply the principle correctly and how violations of the principle can occur if it is not followed. It also lists some recommended reading materials on software design patterns and principles.
The document discusses using the CGI::Prototype framework to manage the complexity of web application flow by defining states as namespaces and handling each part of the request-response process in a modular way. It provides an overview of how CGI::Prototype handles the flow through subclasses that represent each state, and allows changing behavior through accessors and templates. Flexibility comes from being able to change actions and templates without changing any code.
Your code sucks, let's fix it! - php|tek13Rafael Dohms
The document discusses improving code quality through techniques like Object Calisthenics and readability tips. Object Calisthenics are a set of simple exercises to help internalize object-oriented design principles and improve code quality. Some examples of Object Calisthenics rules discussed include having only one indentation level per method and removing duplicated logic. The document also provides an example of refactoring code based on these principles to improve readability, reuseability and performance.
The document discusses Magento's rendering system and how it generates output for the customer. The main goals of rendering are to generate headers and response body. It describes how controllers dispatch requests and set the response body. Layout, blocks and templates are loaded to generate the final HTML output. Key aspects covered include loading and building the layout, finding template files, and directly including templates to render block output.
This document discusses secure coding practices for Drupal. It begins with an introduction of the presenter and covers topics like cross-site scripting, sanitization, access control, SQL injection, and CSRF. Code snippets are provided and attendees are asked to evaluate if they are secure. Recommendations are given around using Drupal APIs, filtering input, and reviewing security advisories. The importance of code reviews, testing, and learning from past issues is stressed.
This document discusses domain-driven design (DDD) as an approach to tackling complexity in software development. DDD focuses on mapping business domain concepts directly into code in order to create software that reflects the business domain rather than frameworks. This is achieved through building a domain model using techniques such as defining entities, value objects, aggregates, repositories, factories and services to encapsulate business logic within the domain layer. Context mapping is also discussed as a way to delineate different bounded contexts and model variations between them.
The document discusses hexagonal architecture and its advantages for building maintainable software. It explains that hexagonal architecture divides a system into loosely coupled components like the application core and interfaces. This decouples the code and allows changes in one part to affect few other places. Ports act as contracts between components, with input and output ports. Adapters provide implementations for the ports. Benefits include increased testability, ability to update frameworks without impacting the domain, and postponing technical decisions. The document provides an example of applying hexagonal architecture with Symfony. It recommends starting with decoupling legacy code using interfaces, dependency injection, and other best practices when refactoring.
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 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.
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/
PHPUnit is a test suite framework that is widely used for PHP projects. It provides improvements over older testing frameworks like SimpleTest, including better command line tools, code coverage reports, assertions, mock objects, and tool chain support. PHPUnit uses annotations and assertions to make tests stricter and more consistent. It supports features like fixtures, mock objects, and code coverage reporting to help test codebases thoroughly. PHPUnit can be run from the command line or a web interface, and integrates with continuous integration servers to run tests automatically.
This document summarizes a presentation on writing secure Drupal code. It discusses common vulnerabilities like cross-site scripting, access bypass, and SQL injection. It demonstrates how to securely code against these vulnerabilities and recommends using tools like Behat tests, security advisories, and contributing to Drupal to improve security. The presentation encourages writing secure code through sanitizing user input, using database placeholders, and following best practices.
The document discusses the SOLID principles of object-oriented design:
- The Single Responsibility Principle states that a class should have one, and only one, reason to change. An example class that violates this principle is refactored to separate concerns into distinct classes.
- The Open/Closed Principle states that a class should be open for extension but closed for modification. An encoder class is refactored to use polymorphism and dependency injection to follow this principle.
- The Liskov Substitution Principle states that subclasses must be substitutable for their base classes. Examples of violations include subclasses not implementing base class methods or having incompatible method signatures.
The document discusses the importance of unit testing and describes how developers are returning to write good tests after cutting corners during economic difficulties. It provides examples of unit tests being written for an order management system using PHPUnit to test the createOrder method by mocking dependencies and asserting the return value.
Building a Portfolio With Custom Post TypesAlex Blackie
This document discusses how to build a portfolio using WordPress custom post types. It provides code examples for creating a "Projects" custom post type and a "Clients" taxonomy. Template files are shown for displaying a portfolio listing page and single project pages. Features like post thumbnails are demonstrated. The custom post types allow organizing portfolio projects under client taxonomy terms in a flexible way.
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.
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/
Hacking Your Way To Better Security - Dutch PHP Conference 2016Colin O'Dell
The goal of this talk is to educate developers on common security vulnerabilities, how they are exploited, and how to protect against them. We'll explore several of the OWASP Top 10 attack vectors like SQL injection, XSS, CSRF, session hijacking, and insecure direct object references. Each topic will be approached from the perspective of an attacker to see how these vulnerabilities are detected and exploited using several realistic examples. Once we've established an understanding of how these attacks work, we'll look at concrete steps you can take to secure web applications against such vulnerabilities. The knowledge gained from this talk can also be used for participating in "Capture the Flag" security competitions.
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.
Performance and testing are just one aspect of code, to really be successful your code needs to be readable, maintainable and generally easier to comprehend and work with. This talk draws from my own experience in applying the techniques of object calisthenics and code readability, within an existing team. It will help you identify trouble areas, learn how to refactor them and train you to write better code in future projects avoiding common pitfalls.
The document discusses the SOLID principles of object-oriented design, which are Single Responsibility Principle, Open Closed Principle, Liskov Substitution Principle, Interface Segregation Principle, and Dependency Inversion Principle. For each principle, it provides an example of how to apply the principle correctly and how violations of the principle can occur if it is not followed. It also lists some recommended reading materials on software design patterns and principles.
The document discusses using the CGI::Prototype framework to manage the complexity of web application flow by defining states as namespaces and handling each part of the request-response process in a modular way. It provides an overview of how CGI::Prototype handles the flow through subclasses that represent each state, and allows changing behavior through accessors and templates. Flexibility comes from being able to change actions and templates without changing any code.
Your code sucks, let's fix it! - php|tek13Rafael Dohms
The document discusses improving code quality through techniques like Object Calisthenics and readability tips. Object Calisthenics are a set of simple exercises to help internalize object-oriented design principles and improve code quality. Some examples of Object Calisthenics rules discussed include having only one indentation level per method and removing duplicated logic. The document also provides an example of refactoring code based on these principles to improve readability, reuseability and performance.
The document discusses Magento's rendering system and how it generates output for the customer. The main goals of rendering are to generate headers and response body. It describes how controllers dispatch requests and set the response body. Layout, blocks and templates are loaded to generate the final HTML output. Key aspects covered include loading and building the layout, finding template files, and directly including templates to render block output.
This document discusses secure coding practices for Drupal. It begins with an introduction of the presenter and covers topics like cross-site scripting, sanitization, access control, SQL injection, and CSRF. Code snippets are provided and attendees are asked to evaluate if they are secure. Recommendations are given around using Drupal APIs, filtering input, and reviewing security advisories. The importance of code reviews, testing, and learning from past issues is stressed.
This document discusses domain-driven design (DDD) as an approach to tackling complexity in software development. DDD focuses on mapping business domain concepts directly into code in order to create software that reflects the business domain rather than frameworks. This is achieved through building a domain model using techniques such as defining entities, value objects, aggregates, repositories, factories and services to encapsulate business logic within the domain layer. Context mapping is also discussed as a way to delineate different bounded contexts and model variations between them.
The document discusses hexagonal architecture and its advantages for building maintainable software. It explains that hexagonal architecture divides a system into loosely coupled components like the application core and interfaces. This decouples the code and allows changes in one part to affect few other places. Ports act as contracts between components, with input and output ports. Adapters provide implementations for the ports. Benefits include increased testability, ability to update frameworks without impacting the domain, and postponing technical decisions. The document provides an example of applying hexagonal architecture with Symfony. It recommends starting with decoupling legacy code using interfaces, dependency injection, and other best practices when refactoring.
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 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.
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.
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.
CDI provides standards-based and typesafe dependency injection in Java EE 6. It integrates well with other Java EE 6 technologies like EJB, JPA, JSF, and JAX-WS. Portable extensions facilitate a richer programming model. Weld is the reference implementation of CDI and is integrated into application servers like GlassFish and JBoss.
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Chicago Coder Conference 2015
Speaker Biography: Wei Ru
Wei Ru has over 15 years of professional experience in design and development of Java enterprise applications across multiple industries. Currently he works as a technical architect at STA Group, LLC. He received a M.S. degree in Computer Science from Loyola University Chicago. As a software developer with an emphasis on Java, he strongly believes in software re-usability, open standards, and various best practices. He has successfully delivered many products using open source platforms and frameworks during his IT consultancies.
Speaker Biography: Vincent Lau
Vincent Lau has been Senior Architect at STA Group in Chicago for the last two years. He received a B.S. degree in Accounting and Finance from the University of Illinois at Chicago and worked on M.S. of Computer Science at DePaul University. He has over 15 years of software design, development, testing and project management experience on large enterprise distributed computing platforms. Most recently, he has worked on web based applications using Java, Spring, JavaScript, Angular.js, jQuery and web services. He previously had Senior Software Engineer and Lead positions in Royal Caribbean Cruises, Wells Fargo Bank, Cap Gemini America and Trans Union Corp.
Presentation: Practical AngularJS
AngularJS has been seen gaining momentum recently. Whether you want to develop a modern single-page application or to spice up only the view enabled by a traditional MVC web framework, AngularJS allows you to write cleaner, shorter code. AngularJS’ two-way data binding feature allows a declarative approach on views and controllers, and ultimately code modulization. With this strategic change and many features offered by AngularJS, learning AngularJS can be challenging. In this session, we will share some of the experiences we had in Angular UI development, we will cover:
AngularJS modules and common project setup
Communicating to a Restful service
Commonly used Angular functions, directives
UI Bootstrap, grid views and forms in AngularJS
Custom Angular directives
Asynchronous functions and event processing
Dependency injection is a powerful technique allowing different parts of a system to collaborate with each other. Injection is the passing of a dependency (such as a service or database connection) to an object that would use it. This way, the object need not change because the outside service changed. This often also allows the object to be more easily tested by injecting a mock or stub service as the dependency.
Using Geeklog as a Web Application FrameworkDirk Haun
Slides for the workshop "Using Geeklog as a Web Application Framework", as held at
- LinuxTag 2006, Wiesbaden, Germany, 2006-05-06
- PHP user group meeting, Stuttgart, Germany, 2006-05-10
- FrOSCon, Bonn, Germany, 2006-06-24
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
This document discusses migrating from Drupal 6 and 7 to Drupal 8. It provides an overview of the Migrate module, which allows importing content and configuration from other Drupal versions or external systems. Key aspects covered include the source and destination plugins, processing pipelines, and the overall migration workflow of mapping, processing and importing data. Examples of how to configure and execute migrations using Drush or custom code are also presented.
This document discusses Wade Arnold's experience with PHP and Zend Framework. It provides an overview of Wade's background working on Zend Amf and other PHP projects. It also includes examples of file structures, models, and services that demonstrate how to build a PHP application that integrates with Flash using Zend Amf. The document advocates for using standards like Zend Framework to build robust PHP applications and services.
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
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
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 приложениях.
This document provides an overview and examples of the SOLID principles of object-oriented design:
- SRP (Single Responsibility Principle) states that a class should have one, and only one, reason to change. Examples show extracting validation and email sending logic into separate classes.
- OCP (Open-Closed Principle) states that software entities should be open for extension but closed for modification. Examples use inheritance and interfaces to add new filtering logic without modifying existing classes.
- LSP (Liskov Substitution Principle) states that subclasses must be substitutable for their base classes. Examples show invalid implementations that break the base class contract.
- ISP (Interface Segregation Principle
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.
Takashi Kobayashi and Hironori Washizaki, "SWEBOK Guide and Future of SE Education," First International Symposium on the Future of Software Engineering (FUSE), June 3-6, 2024, Okinawa, Japan
Do you want Software for your Business? Visit Deuglo
Deuglo has top Software Developers in India. They are experts in software development and help design and create custom Software solutions.
Deuglo follows seven steps methods for delivering their services to their customers. They called it the Software development life cycle process (SDLC).
Requirement — Collecting the Requirements is the first Phase in the SSLC process.
Feasibility Study — after completing the requirement process they move to the design phase.
Design — in this phase, they start designing the software.
Coding — when designing is completed, the developers start coding for the software.
Testing — in this phase when the coding of the software is done the testing team will start testing.
Installation — after completion of testing, the application opens to the live server and launches!
Maintenance — after completing the software development, customers start using the software.
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.
SOCRadar's Aviation Industry Q1 Incident Report is out now!
The aviation industry has always been a prime target for cybercriminals due to its critical infrastructure and high stakes. In the first quarter of 2024, the sector faced an alarming surge in cybersecurity threats, revealing its vulnerabilities and the relentless sophistication of cyber attackers.
SOCRadar’s Aviation Industry, Quarterly Incident Report, provides an in-depth analysis of these threats, detected and examined through our extensive monitoring of hacker forums, Telegram channels, and dark web platforms.
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.
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Looking for a reliable mobile app development company in Noida? Look no further than Drona Infotech. We specialize in creating customized apps for your business needs.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
What is Augmented Reality Image Trackingpavan998932
Augmented Reality (AR) Image Tracking is a technology that enables AR applications to recognize and track images in the real world, overlaying digital content onto them. This enhances the user's interaction with their environment by providing additional information and interactive elements directly tied to physical images.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...kalichargn70th171
A dynamic process unfolds in the intricate realm of software development, dedicated to crafting and sustaining products that effortlessly address user needs. Amidst vital stages like market analysis and requirement assessments, the heart of software development lies in the meticulous creation and upkeep of source code. Code alterations are inherent, challenging code quality, particularly under stringent deadlines.
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeAftab Hussain
Understanding variable roles in code has been found to be helpful by students
in learning programming -- could variable roles help deep neural models in
performing coding tasks? We do an exploratory study.
- These are slides of the talk given at InteNSE'23: The 1st International Workshop on Interpretability and Robustness in Neural Software Engineering, co-located with the 45th International Conference on Software Engineering, ICSE 2023, Melbourne Australia
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfUndress Baby
The quest for the best AI face swap solution is marked by an amalgamation of technological prowess and artistic finesse, where cutting-edge algorithms seamlessly replace faces in images or videos with striking realism. Leveraging advanced deep learning techniques, the best AI face swap tools meticulously analyze facial features, lighting conditions, and expressions to execute flawless transformations, ensuring natural-looking results that blur the line between reality and illusion, captivating users with their ingenuity and sophistication.
Web:- https://undressbaby.com/
Utilocate offers a comprehensive solution for locate ticket management by automating and streamlining the entire process. By integrating with Geospatial Information Systems (GIS), it provides accurate mapping and visualization of utility locations, enhancing decision-making and reducing the risk of errors. The system's advanced data analytics tools help identify trends, predict potential issues, and optimize resource allocation, making the locate ticket management process smarter and more efficient. Additionally, automated ticket management ensures consistency and reduces human error, while real-time notifications keep all relevant personnel informed and ready to respond promptly.
The system's ability to streamline workflows and automate ticket routing significantly reduces the time taken to process each ticket, making the process faster and more efficient. Mobile access allows field technicians to update ticket information on the go, ensuring that the latest information is always available and accelerating the locate process. Overall, Utilocate not only enhances the efficiency and accuracy of locate ticket management but also improves safety by minimizing the risk of utility damage through precise and timely locates.
GraphSummit Paris - The art of the possible with Graph TechnologyNeo4j
Sudhir Hasbe, Chief Product Officer, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
2. Abstract
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.
7. class Product
{
public function getId()
public function getName()
public function getPrice()
public function getStock()
public function setStock($stock)
public function getDescription()
}
https://github.com/neilcrookes/SoSOLIDFu
8. class CreditCard
{
public function getExpiryYear()
public function getExpiryMonth()
public function getLast4()
public function getToken()
}
https://github.com/neilcrookes/SoSOLIDFu
10. class Shop
{
public function addToBasket(Product $product)
public function removeFromBasket(Product $product)
public function getTotal()
public function getBasket()
public function checkout(CreditCard $card)
protected function sendOrderConfirmationEmail(CreditCard $card)
}
https://github.com/neilcrookes/SoSOLIDFu
12. class Shop
{
public function addToBasket(Product $product)
public function removeFromBasket(Product $product)
public function getTotal()
public function getBasket()
public function checkout(CreditCard $card)
protected function sendOrderConfirmationEmail(CreditCard $card)
}
https://github.com/neilcrookes/SoSOLIDFu
13. class Shop
{
public function addToBasket(Product $product)
public function removeFromBasket(Product $product)
public function getTotal()
public function getBasket()
public function checkout(CreditCard $card)
protected function sendOrderConfirmationEmail(CreditCard $card)
}
https://github.com/neilcrookes/SoSOLIDFu
14. class Basket
{
public function addToBasket(Product $product)
public function removeFromBasket(Product $product)
public function getTotal()
public function getBasket()
}
Class Checkout
{
public function checkout(CreditCard $card)
protected function sendOrderConfirmationEmail(CreditCard $card)
}
https://github.com/neilcrookes/SoSOLIDFu
16. Open / Closed
Objects or libraries should be open for extension, but closed for modification.
● Easy to add new features OR change behaviour
● Without modifying original
● Purists: without extending original…!?
Eh?
18. Open / Closed cont
Closed for modification - Clarity of intent
● Final classes
● Private members
● Encourage extension in expected / supported way
● Encourages decoupling
● Reduces risk of breaking changes
19. final class Checkout
{
public function checkout(Basket $basket, CreditCard $card)
{
try
{
$reference = $this->gateway->purchase($basket, $card);
$this->sendOrderConfirmationEmail($basket, $card);
fire(new CheckoutEvent($basket));
return true;
}
catch (GatewayException $e)
{
return false;
}
}
}
https://github.com/neilcrookes/SoSOLIDFu
20. final class Checkout
{
public function sendOrderConfirmationEmail(Basket $basket, CreditCard $card)
{
$message = "Thank you for your order.n";
foreach ($basket as $item)
{
/** @var Product $product */
$product = $item['product'];
$message .= "n" . $product->getName() . ' x ' . $item['quantity']
. ' @ £' . $product->getPrice();
}
$message .= "nnPayment has been taken from: xxxx xxxx xxxx " . $card->getLast4()
. ' Ex: ' . $card->getExpiryMonth() . '/' . $card->getExpiryYear();
mail('customer@domain.com', 'Your order at my store', $message);
}
}
https://github.com/neilcrookes/SoSOLIDFu
21. Liskov Substitution
States that you should be able to swap dependencies for a subclass class without
causing unexpected results
22. final class Checkout
{
public function sendOrderConfirmationEmail(Basket $basket, CreditCard $card)
{
$message = "Thank you for your order.n";
foreach ($basket as $item)
{
/** @var Product $product */
$product = $item['product'];
$message .= "n" . $product->getBasketTitle() . ' x ' . $item['quantity']
. ' @ £' . $product->getPrice();
}
$message .= "nnPayment has been taken from: xxxx xxxx xxxx " . $card->getLast4()
. ' Ex: ' . $card->getExpiryMonth() . '/' . $card->getExpiryYear();
mail('customer@domain.com', 'Your order at my store', $message);
}
}
https://github.com/neilcrookes/SoSOLIDFu
23. interface PurchasableInterface
{
public function getId();
public function getPrice();
public function getStock();
public function setStock($stock);
public function getBasketTitle();
}
https://github.com/neilcrookes/SoSOLIDFu
24. Interface
Segregation
● An interface should only impose the methods that a client relies on
● Split unrelated interface methods into separate interfaces
25. interface PurchasableInterface
{
public function getId();
public function getPrice();
public function getBasketTitle();
}
interface StockableInterface
{
public function getStock();
public function setStock($stock);
}
https://github.com/neilcrookes/SoSOLIDFu
26. final class Checkout
{
public function checkout(Basket $basket, CreditCard $card)
}
class Gateway
{
public function purchase(Basket $basket, CreditCard $card)
}
https://github.com/neilcrookes/SoSOLIDFu
27. Dependency
Inversion
● High level should not depend on low level modules, both should depend on
abstractions
● Abstractions should not depend upon details. Details should depend upon
abstractions.
● Depend on abstractions (abstracts / interfaces), not concretes
● Code to an Interface
28. interface ChargeableInterface
{
public function getChargeableAmount();
}
interface GatewayInterface
{
public function charge(ChargeableInterface $chargeable,
PaymentMethodInterface $paymentMethod);
}
interface PaymentMethodInterface
{
public function getToken();
public function getDetails();
}
https://github.com/neilcrookes/SoSOLIDFu
29. final class Checkout
{
public function checkout(ChargeableInterface $basket, PaymentMethodInterface $card)
}
class Gateway
{
public function purchase(ChargeableInterface $basket, PaymentMethodInterface $card)
}
https://github.com/neilcrookes/SoSOLIDFu
30. Conclusion:
Get Classy
● Actually only add some Interfaces, and an Event
● Our code is designed much better
● Easy to understand, extend
● More robust, less likely to introduce bugs
● Lots of classes is fine
● Lots of interfaces is fine