As presented at Dutch PHP Conference 2015, an introduction to command buses, how to implement your own in PHP and why they're both useful but unimportant.
PHP remains the most popular server-side language on the Web and the most favoured language for Web attacks. The security vulnerabilities and attack techniques become more sophisticated though. For example, the vulnerability types PHP Object Instantiation and Phar Deserialization are comparatively unknown to traditional types like XSS and SQLi. In this technical talk, we look at a couple of critical security bugs found in popular open source PHP applications, such as WordPress, WooCommerce and Shopware. We will focus on fundamental design flaws and new state-of-the-art exploitation techniques that are used by attackers to compromise web servers through these issues which can occur in any other application as well.
Presentation made at GTA meetup in 2012-02-07.
Object Calisthenics is a set of exercise rules to reach better code, maintainable, testable and readable.
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
(Video and code at http://fsharpforfunandprofit.com/composition)
Composition is a fundamental principle of functional programming, but how is it different from an object-oriented approach, and how do you use it in practice?
In this talk for beginners, we'll start by going over the basic concepts of functional programming, and then look at some different ways that composition can be used to build large things from small things.
After that, we'll see how composition is used in practice, beginning with a simple FizzBuzz example, and ending with a complete (object-free!) web application.
PHP remains the most popular server-side language on the Web and the most favoured language for Web attacks. The security vulnerabilities and attack techniques become more sophisticated though. For example, the vulnerability types PHP Object Instantiation and Phar Deserialization are comparatively unknown to traditional types like XSS and SQLi. In this technical talk, we look at a couple of critical security bugs found in popular open source PHP applications, such as WordPress, WooCommerce and Shopware. We will focus on fundamental design flaws and new state-of-the-art exploitation techniques that are used by attackers to compromise web servers through these issues which can occur in any other application as well.
Presentation made at GTA meetup in 2012-02-07.
Object Calisthenics is a set of exercise rules to reach better code, maintainable, testable and readable.
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
(Video and code at http://fsharpforfunandprofit.com/composition)
Composition is a fundamental principle of functional programming, but how is it different from an object-oriented approach, and how do you use it in practice?
In this talk for beginners, we'll start by going over the basic concepts of functional programming, and then look at some different ways that composition can be used to build large things from small things.
After that, we'll see how composition is used in practice, beginning with a simple FizzBuzz example, and ending with a complete (object-free!) web application.
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.
Composition is a fundamental principle of functional programming, but how is it different from an object-oriented approach, and how do you use it in practice?
In this talk for beginners, we'll start by going over the basic concepts of functional programming, and then look at some different ways that composition can be used to build large things from small things.
After that, we'll see how composition is used in practice, beginning with a simple FizzBuzz example, and ending with a complete (object-free!) web application.
(Video of these slides here http://fsharpforfunandprofit.com/rop)
(My response to "this is just Either" here: http://fsharpforfunandprofit.com/rop/#monads)
Many examples in functional programming assume that you are always on the "happy path". But to create a robust real world application you must deal with validation, logging, network and service errors, and other annoyances.
So, how do you handle all this in a clean functional way? This talk will provide a brief introduction to this topic, using a fun and easy-to-understand railway analogy.
From framework coupled code to #microservices through #DDD /by @codelytvCodelyTV
Slides from the talk about our evolution as developers. We start talking about the first spaghetti code that we made and end up talking about which are the differences between:
* Framework coupled code
* DDD modules
* Bounded Contexts
* Microservices
Blog post: http://codely.tv/screencasts/codigo-acoplado-framework-microservicios-ddd
YouTube video (Spanish): https://www.youtube.com/watch?v=o0w-jYun6AU
Twitter: https://twitter.com/CodelyTV
Domain Driven Design with the F# type System -- NDC London 2013Scott Wlaschin
(Video of these slides here http://fsharpforfunandprofit.com/ddd)
Statically typed functional programming languages like F# encourage a very different way of thinking about types. The type system is your friend, not an annoyance, and can be used in many ways that might not be familiar to OO programmers.
Types can be used to represent the domain in a fine-grained, self documenting way. And in many cases, types can even be used to encode business rules so that you literally cannot create incorrect code. You can then use the static type checking almost as an instant unit test — making sure that your code is correct at compile time.
In this talk, we'll look at some of the ways you can use types as part of a domain driven design process, with some simple real world examples in F#. No jargon, no maths, and no prior F# experience necessary.
Code, links to video, etc., at http://fsharpforfunandprofit.com/ddd
For more on DDD and F# see:
http://fsharpforfunandprofit.com/ddd/
http://tomasp.net/blog/type-first-development.aspx/
http://gorodinski.com/blog/2013/02/17/domain-driven-design-with-fsharp-and-eventstore/
(Video and code at https://fsharpforfunandprofit.com/pipeline/)
Passing data through a pipeline of transformations is an alternative approach to classic OOP. The LINQ methods in .NET are designed around this, but the pipeline approach can be used for so much more than manipulating collections.
In this talk, I'll look at pipeline-oriented programming and how it relates to functional programming, the open-closed principle, unit testing, the onion architecture, and more. I'll finish up by showing how you can build a complete web app using only this approach.
Java if else condition - powerpoint persentationManeesha Caldera
Conditions are one of a major feature in any programming language. This slide deck is discussing how to work with java conditions by using if else statement. Further discussing extends of if else statement.
Symfony: Your Next Microframework (SymfonyCon 2015)Ryan Weaver
Microservices are a huge trend, and microframeworks are perfect for them: put together just a few files, write some code, and your done!
But Symfony is a big framework, right? Wrong! Symfony can be as small as a single file!
In this talk, we'll learn how to use Symfony as a micro-framework for your next project. Your app will stay small and clear, but without needing to give up the features or third-party bundles that you love. And if the project grows, it can evolve naturally into a full Symfony project.
So yes, Symfony can also be a microframework. Tell the world!
Nobody wants to work in a large ball of mud that becomes harder to manage as time goes on. Proven software architectures tells us to break the system into more manageable components that are isolated from each other.
Years back (before Composer) in symfony1 era we had a single SVN repository, that required a lot of discipline to keep our codebase decoupled and clean. After migrating to Symfony 2 we broke the project into more manageable components that were in separate Git repositories. Unfortunately it quickly became a huge overhead and nightmare to deal with.
We learned the hard why that all the benefits come from having isolated packages not breaking things into separate repositories.
Now we have a single Git repository, again. This isn't a bad idea; to my knowledge Facebook, Twitter, and Google all have a big monolithic source repos but we needed a solution that works for a lot smaller fish :)
With a little help, Composer made this possible for us - so you can have your cake and eat it too!
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.
Composition is a fundamental principle of functional programming, but how is it different from an object-oriented approach, and how do you use it in practice?
In this talk for beginners, we'll start by going over the basic concepts of functional programming, and then look at some different ways that composition can be used to build large things from small things.
After that, we'll see how composition is used in practice, beginning with a simple FizzBuzz example, and ending with a complete (object-free!) web application.
(Video of these slides here http://fsharpforfunandprofit.com/rop)
(My response to "this is just Either" here: http://fsharpforfunandprofit.com/rop/#monads)
Many examples in functional programming assume that you are always on the "happy path". But to create a robust real world application you must deal with validation, logging, network and service errors, and other annoyances.
So, how do you handle all this in a clean functional way? This talk will provide a brief introduction to this topic, using a fun and easy-to-understand railway analogy.
From framework coupled code to #microservices through #DDD /by @codelytvCodelyTV
Slides from the talk about our evolution as developers. We start talking about the first spaghetti code that we made and end up talking about which are the differences between:
* Framework coupled code
* DDD modules
* Bounded Contexts
* Microservices
Blog post: http://codely.tv/screencasts/codigo-acoplado-framework-microservicios-ddd
YouTube video (Spanish): https://www.youtube.com/watch?v=o0w-jYun6AU
Twitter: https://twitter.com/CodelyTV
Domain Driven Design with the F# type System -- NDC London 2013Scott Wlaschin
(Video of these slides here http://fsharpforfunandprofit.com/ddd)
Statically typed functional programming languages like F# encourage a very different way of thinking about types. The type system is your friend, not an annoyance, and can be used in many ways that might not be familiar to OO programmers.
Types can be used to represent the domain in a fine-grained, self documenting way. And in many cases, types can even be used to encode business rules so that you literally cannot create incorrect code. You can then use the static type checking almost as an instant unit test — making sure that your code is correct at compile time.
In this talk, we'll look at some of the ways you can use types as part of a domain driven design process, with some simple real world examples in F#. No jargon, no maths, and no prior F# experience necessary.
Code, links to video, etc., at http://fsharpforfunandprofit.com/ddd
For more on DDD and F# see:
http://fsharpforfunandprofit.com/ddd/
http://tomasp.net/blog/type-first-development.aspx/
http://gorodinski.com/blog/2013/02/17/domain-driven-design-with-fsharp-and-eventstore/
(Video and code at https://fsharpforfunandprofit.com/pipeline/)
Passing data through a pipeline of transformations is an alternative approach to classic OOP. The LINQ methods in .NET are designed around this, but the pipeline approach can be used for so much more than manipulating collections.
In this talk, I'll look at pipeline-oriented programming and how it relates to functional programming, the open-closed principle, unit testing, the onion architecture, and more. I'll finish up by showing how you can build a complete web app using only this approach.
Java if else condition - powerpoint persentationManeesha Caldera
Conditions are one of a major feature in any programming language. This slide deck is discussing how to work with java conditions by using if else statement. Further discussing extends of if else statement.
Symfony: Your Next Microframework (SymfonyCon 2015)Ryan Weaver
Microservices are a huge trend, and microframeworks are perfect for them: put together just a few files, write some code, and your done!
But Symfony is a big framework, right? Wrong! Symfony can be as small as a single file!
In this talk, we'll learn how to use Symfony as a micro-framework for your next project. Your app will stay small and clear, but without needing to give up the features or third-party bundles that you love. And if the project grows, it can evolve naturally into a full Symfony project.
So yes, Symfony can also be a microframework. Tell the world!
Nobody wants to work in a large ball of mud that becomes harder to manage as time goes on. Proven software architectures tells us to break the system into more manageable components that are isolated from each other.
Years back (before Composer) in symfony1 era we had a single SVN repository, that required a lot of discipline to keep our codebase decoupled and clean. After migrating to Symfony 2 we broke the project into more manageable components that were in separate Git repositories. Unfortunately it quickly became a huge overhead and nightmare to deal with.
We learned the hard why that all the benefits come from having isolated packages not breaking things into separate repositories.
Now we have a single Git repository, again. This isn't a bad idea; to my knowledge Facebook, Twitter, and Google all have a big monolithic source repos but we needed a solution that works for a lot smaller fish :)
With a little help, Composer made this possible for us - so you can have your cake and eat it too!
Models and Service Layers, Hemoglobin and HobgoblinsRoss Tuck
As presented at ZendCon 2014, AmsterdamPHP, PHPBenelux 2014, Sweetlake PHP and PHP Northwest 2013, an overview of some different patterns for integrating and managing logic throughout your application.
Commands, events, queries - three types of messages that travel through your application. Some originate from the web, some from the command-line. Your application sends some of them to a database, or a message queue. What is the ideal infrastructure for an application to support this on-going stream of messages? What kind of architectural design fits best?
This talk provides answers to these questions: we take the *hexagonal* approach to software architecture. We look at messages, how they cross boundaries and how you can make steady communication lines between your application and other systems, like web browsers, terminals, databases and message queues.
You will learn how to separate the technical aspects of these connections from the core behavior of your application by implementing design patterns like the *command bus*, and design principles like *dependency inversion*.
Closing keynote, as presented at Codemotion 2014, LaraconEU 2014, Redevelop 2014, CodeConnexx 2013 and PHP North East 2014.
This presentation makes a reference to a reading list I received. For those interested, the release consists of most of the general classics, such as Gang Of Four "Design Patterns", The Pragmatic Programmer, Structure and Interpretation of Computer Programs, Domain Driven Design and a few others. The actual list remains tucked away in a box somewhere.
The quest for global design principles (SymfonyLive Berlin 2015)Matthias Noback
If you’re a programmer you make design decisions every second. You need to think, and often think hard, about everything. Luckily there are many useful design principles and patterns that you can apply. But some of them merely expose code smells. Others only help you design your classes. And some are applicable to packages only. Wouldn’t it be nice to have some more general, always useful, invariably applicable, foundational design principles? In this talk we’ll look at software from many different perspectives, and while we’re zooming in and out, we’ll discover some of the deeper principles that form the basis of proper object-oriented design. After attending this talk you will be able to make better design decisions by reflecting on the stream of messages that is flowing from object to object, and from application to application.
Replacing dependents with doubles is a central part of testing that every developer has to master. This talk goes over the different types of doubles and explains their place in testing, how to implement them in a mainstream mocking framework, and which strategies or doubles to use in different message exchange scenarios between objects. After this talk you will have moved a step forward in your understanding of testing in the context of object oriented programming.
Marcello reflects over the craftsmanship manifesto and its elements to uncover some interesting insights regarding the application of the underlying principles in real life projects and in the context of organisations and communities struggling to live up to the expectations it creates.
Writing infinite scalability web applications with PHP and PostgreSQLGabriele Bartolini
PostgreSQL 9.2 introduced native support for the JSON data type, as well as V8/Javascript and Coffeescript procedural languages.
Learn how you can write web applications in PHP using an intelligent and horizontally sharded cluster of PostgreSQL databases, bringing you infinite scalability and parallel processing.
This talk will guide you through the development lifecycle of the application, focusing on architecture, technologies, testing and deployment.
Si le tdd est mort alors pratiquons une autopsie mix-it 2015Bruno Boucard
Si Michel-Ange avait été développeur quels auraient été ses secrets. Quelle était la posture de cet artiste ? Quelle place occupent nos modèles mentaux lorsque nous développons ? La notion de design émergent qui accompagne les approches test-first (TDD, BDD,…) peut rendre plus d’une personne sceptique. En effet, comment concilier nos intuitions et projections mentales avec cette approche a priori minimaliste et contre-intuitive ?
L'ABC du BDD (Behavior Driven Development)Arnauld Loyer
Une introduction au Behavior Driven Development, avec plein d'idées pour tout de suite! et applicable à tout projet. Il sera question:
* de passer de l'incompréhension à savoir qu'on ne sait pas
* des westerns spaghetti aux Three Amigos,
* de reléguer le Comment au second plan pour laisser sa place au Pourquoi!
* de rendre des spécifications exécutables
* de découvrir qu'un concombre n'est pas qu'un Cucurbitacée aux feuilles tri-lobées
* d'automatisation comme outil de non-regression
Au cours de cette session, nous expliquerons ce qu'est le BDD. Nous verrons qu'il n'est pas question d'outils ou de tests, mais de collaboration et de discussion entre les différentes parties prenantes: du métier aux développeurs en passant par les testeurs. Cette presentation s'adresse à l'ensemble de ces populations en expliquant l'importance qu'il y a à se comprendre, et qu'il n'est pas nécessaire d'avoir des outils sophistiqués pour avoir des bénéfices immédiats.
Nous verrons quelques pratiques de discussion qui permettent d'arriver à une meilleure compréhension et à une description du besoin. Nous verrons aussi comment des exemples concrets permettent de s'assurer d'une compréhension commune et comment ils permettent de construire un langage unique et non ambigu. Nous verrons comment rendre ces spécifications executables en réutilisant les exemples construits précédemment et en les automatisant. Ceux-ci viendront renforcer les tests d'acceptance et devenir des tests de non regressions. Enfin, nous verrons que cette démarche nous permettra d'avoir une documentation vivante et toujours à jour de notre système.
Idées pour tout de suite
Communication, Clarification par des Exemples concrets, Spécifications exécutables
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
This session introduces most well known design patterns to build PHP classes and objects that need to store and fetch data from a relational databases. The session will describe the difference between of the Active Record, the Table and Row Data Gateway and the Data Mapper pattern. We will also examine some technical advantages and drawbacks of these implementations. This talk will expose some of the best PHP tools, which ease database interactions and are built on top of these patterns.
Transducers are a type of reducing function that take in a reducing function and give back another reducing function. They allow you to compose functions together in a chain or pipeline structure to quickly, easily and efficiently transform data. In PHP, we have the mtdowling/transducers library, built off the basis of the idea of Clojure's transducer library.
Symfony2 - extending the console componentHugo Hamon
The goal of this session is to explain how to take benefit from the Symfony2 command line interface tool. First, I have a closer look at the most interesting commands to generate code and help you reduce your development time. Then, I will show you how to create your own commands to extend the Symfony CLI tool and automate your tedious and redundant tasks. This part of the talk will also explain how to create interactive tasks, interact with the database, generating links or send emails from the command line. Of course, there will be a focus on how to design your commands the best way to make them as much testable as possible.
Presentation of the command dispatcher pattern I made during one of the chapter meetings in HelloFresh.
Companion article: https://olvlvl.com/2018-04-command-dispatcher-pattern
Writing readable code is one of the most important aspects of web development. A developer should write code which another human is able to understand without the help of too many comments.
This talk will show you how to tidy up your code and write readable PHP.
Est-ce que nous allons parler de gestion des ressources humaines au PHP tour ? Non, je vous vais vous parler des modèles anémiques et des modèles riches. Depuis des années frameworks et ORM nous conditionnent à utiliser des modèles anémiques, une classe avec de simples setters et getters. A travers l’histoire d’Estelle, une RH, qui veut une application pour gérer ses salariés, je vais vous montrer comment changer nos vieilles habitudes afin de nous focaliser sur le métier que nous implémentons. Nous verrons ensemble quels outils utiliser, comme par exemple, le design pattern command bus, l’opérateur NEW de doctrine pour vos Data Transfert Object dans une application Symfony.
Example de code : https://github.com/arnolanglade/code-me-hr
Software development is riddled with explicit and implicit costs. Every decision you make has a cost attached to it. When you're writing code, you're making an investment, the size of which will for a long time define the costs of your future growth. Making right decision about these investments is very tricky and the cost of wrong decisions might be crippling for both business and teams that support it.
Extreme Programming and Test Driven Development in particular are practices that are aiming at supporting development effort by making it easier to introduce change. That said, sometimes those tools can become a problem of its own when applied in the wrong way or for the wrong context. Understanding software cost forces is a very important skill of successful teams and something that helps understand how to apply XP and TDD in different contexts.
Your code sucks, let's fix it - DPC UnConRafael Dohms
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
Talk I gave at Maceió DEV Meetup #6. Not only about Command Bus/Command Interface or whatever you name it, but a compilation of cool articles I found only that may help with understanding this architecture.
By the sum of PHPUnit assertion power and Symfony2 functional testing tools the developer can obtain a deep control on the developed application.
Here you can find some suggestions on how to leverage that power.
Code smell is any symptom in the source code of a program that possibly indicates a deeper problem.
So let's see what are code smell we can remove from our code.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
9. class BUYBUYBUYController
{
public function buyAction(Request $request)
{
$form = $this->getForm();
$form->bindTo($request);
if ($form->isTotallyValid()) {
$store->purchaseGame($gameId, $customerId);
return $this->redirect('thanks_for_money');
}
return ['so_many_errors' => $form->getAllTheErrors()];
}
}
10. class Store
{
public function purchaseGame($gameId, $customerId)
{
Assert::notNull($gameId);
Assert::notNull($customerId);
$this->security->allowsPurchase($customerId);
$this->logging->debug('purchasing game');
try {
$this->db->beginTransaction();
$purchase = new Purchase($gameId, $customerId);
$this->repository->add($purchase);
$this->db->commitTransaction();
} catch(Exception $e) {
$this->db->rollbackTransaction();
throw $e;
}
}
}
11. class Store
{
public function purchaseGame($gameId, $customerId)
{
$purchase = new Purchase($gameId, $customerId);
$this->repository->add($purchase);
}
}
41. class PurchaseGame
{
private $gameId;
private $customerId;
public function __construct($gameId, $customerId)
{
$this->gameId = $gameId;
$this->customerId = $customerId;
}
public function getGameId()
{
return $this->gameId;
}
public function getCustomerId()
{
return $this->customerId;
}
}
42. class PurchaseController
{
public function purchaseGameAction(Request $request)
{
$form = $this->createForm('purchase_game');
$form->bind($request);
if ($form->isValid()) {
$command = $form->getData();
}
}
}
62. class PurchaseController
{
public function purchaseGameAction()
{
// form stuff lol
$command = $form->getData();
$this->handler->handle($command);
}
}
Controller
Must be
the RIGHT handler
73. class CommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$this->handlers[$name]->handle($command);
}
}
78. class CommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$this->handlers[$name]->handle($command);
}
}
79. class CommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$this->handlers[$name]->execute($command);
}
}
80. class CommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$this->handlers[$name]->__invoke($command);
}
}
81. class CommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$methodName = 'handle'.$name;
$this->handlers[$name]->{$methodName}($command);
}
}
82. class CommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$this->handlers[$name]->handle($command);
}
}
83. class CommandBus
{
private $container = [];
public function __construct($container) {
$this->container = $container;
}
public function handle($command)
{
$name = get_class($command)."Handler";
if (!$this->container->has($name)) {
throw new Exception("No handler for $name");
}
$this->container->get($name)->handle($command);
}
}
96. class CommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$this->handlers[$name]->handle($command);
}
}
97. class MyCommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$this->handlers[$name]->handle($command);
}
}
98. class MyCommandBus implements CommandBus
{
private $handlers = [];
public function __construct($handlers) {
$this->handlers = $handlers;
}
public function handle($command)
{
$name = get_class($command);
if (!isset($this->handlers[$name])) {
throw new Exception("No handler for $name");
}
$this->handlers[$name]->handle($command);
}
}
117. class PurchaseGameHandler
{
public function handle(PurchaseGame $command)
{
$this->security->allowsPurchase($command->getCustomerId());
try {
$this->db->beginTransaction();
$purchase = new Purchase(
$command->getGameId(),
$command->getCustomerId()
);
$this->repository->add($purchase);
$this->db->commitTransaction();
} catch(Exception $e) {
$this->db->rollbackTransaction();
throw $e;
}
}
}
118. class PurchaseGameHandler
{
public function handle(PurchaseGame $command)
{
$this->security->allowsPurchase($command->getCustomerId());
$purchase = new Purchase(
$command->getGameId(),
$command->getCustomerId()
);
$this->repository->add($purchase);
}
}
127. class AllowedPurchaseDecorator implements CommandBus
{
private $security;
private $innerBus;
public function __construct($security, $innerBus)
{
$this->security = $security;
$this->innerBus = $innerBus;
}
public function handle($command)
{
if ($command instanceof PurchaseCommand) {
$this->security->allowPurchase($command->getCustomerId());
}
$this->innerBus->handle($command);
}
}
128. class PurchaseGameHandler
{
public function handle(PurchaseGame $command)
{
$this->security->allowsPurchase($command->getCustomerId());
$purchase = new Purchase(
$command->getGameId(),
$command->getCustomerId()
);
$this->repository->add($purchase);
}
}
129. class PurchaseGameHandler
{
public function handle(PurchaseGame $command)
{
$purchase = new Purchase(
$command->getGameId(),
$command->getCustomerId()
);
$this->repository->add($purchase);
}
}
130. class PurchaseGameHandler
{
public function handle(PurchaseGame $command)
{
$purchase = new Purchase(
$command->getGameId(),
$command->getCustomerId()
);
$this->repository->add($purchase);
}
}
Stop cutting!