Unit tests are great, they help a developer gain control over his code and catch bugs and regression issues.
Test Driven Development is a methodology that uses unit tests but it's not about writing unit tests - in fact the tests are only a design tool.
TDD is a methodology that solves problems in an iterative way, it's about emergent design that creates a maintainable solution.
In this session I'll talk about common mistakes and misconceptions, how to benefit from TDD and show how to design your code using unit tests.
The code for this talk can be found on GitHub: https://github.com/dhelper/DesignWIthTests
In many projects, the learning curve for new project members is simply too steep. Following a high-level systems introduction (frequently laden with slews of somewhat meaningless presentation pictures), a new developer is assigned to a team and exposed to a large and unknown legacy code base.
The next ? frustrating ? phase taxes the patience of managers, colleagues, and newcomers alike: everyone wants to reduce the time before the newcomer can become productive. How can the code structure help achieve this?
This session presents some battle-proven recommendations for structuring projects and code to increase visibility and reduce the learning curve for old and new project members alike.
Lennart Jörelid, jGuru
Let us first start with some basics of C++ programming language and understand briefly what Design Patterns are and why they are so cool.
The slides below explain the C++ features first, followed by an introduction to Design Patterns in software architecture. These are still in outline form. But, considering that the content may be of value to several readers in the software engineering industry, I wanted to get the information out first.
This slide introduces you what unit testing is, differences between functional testing and unit testing. Furthermore, it tells you the concepts about jasmine and sinon.js
What Does It Really Mean to Be an Architect?Eberhard Wolff
This presentation was the keynote at ECSA2011. It talks talks about the definition of architecture, architect and the responsibilities the architect should have in a project.
Unit tests are great, they help a developer gain control over his code and catch bugs and regression issues.
Test Driven Development is a methodology that uses unit tests but it's not about writing unit tests - in fact the tests are only a design tool.
TDD is a methodology that solves problems in an iterative way, it's about emergent design that creates a maintainable solution.
In this session I'll talk about common mistakes and misconceptions, how to benefit from TDD and show how to design your code using unit tests.
The code for this talk can be found on GitHub: https://github.com/dhelper/DesignWIthTests
In many projects, the learning curve for new project members is simply too steep. Following a high-level systems introduction (frequently laden with slews of somewhat meaningless presentation pictures), a new developer is assigned to a team and exposed to a large and unknown legacy code base.
The next ? frustrating ? phase taxes the patience of managers, colleagues, and newcomers alike: everyone wants to reduce the time before the newcomer can become productive. How can the code structure help achieve this?
This session presents some battle-proven recommendations for structuring projects and code to increase visibility and reduce the learning curve for old and new project members alike.
Lennart Jörelid, jGuru
Let us first start with some basics of C++ programming language and understand briefly what Design Patterns are and why they are so cool.
The slides below explain the C++ features first, followed by an introduction to Design Patterns in software architecture. These are still in outline form. But, considering that the content may be of value to several readers in the software engineering industry, I wanted to get the information out first.
This slide introduces you what unit testing is, differences between functional testing and unit testing. Furthermore, it tells you the concepts about jasmine and sinon.js
What Does It Really Mean to Be an Architect?Eberhard Wolff
This presentation was the keynote at ECSA2011. It talks talks about the definition of architecture, architect and the responsibilities the architect should have in a project.
One reasonable definition of good design is testability. It is hard to imagine a software system that is both testable and poorly designed. It is also hard to imagine a software system that is well designed but also untestable.
I'll talk you through how bad design may affect testability. We will learn how to design robust tests which are not just increasing code coverage but are bringing real value to your project.
Finally we will explore the best way to integrate these tests to your continuous integration environment so they will be acting as top class guards against sloppy commits.
Keywords : design principles, unit tests, integration tests, stress tests, java, spring, junit @Rule, junit @Category, @RunWith, @Parameters, surefire, maven, jenkins, quality metrics, selenium , tdd, mocks, stubs, etc...
Do your unit tests feel like a chore to maintain? Are they sometimes useful but come with a high maintenance cost? Do you secretly believe you’d work faster without them there? A great test suite should help speed up your development process, not slow you down. This talk highlights some techniques you can use to improve the front-end unit tests you write.
Top 50 .NET Interview Questions and Answers 2019 | EdurekaEdureka!
YouTube Link: https://youtu.be/5WwzmjgmqUA
** Microsoft .NET Certification Training: edureka.co/microsoft-dotnet-framework-self-paced **
This Edureka PPT on '.NET Interview Questions and Answers' will help you understand the frequently asked interview questions for .NET. Following are the topics discussed:
Beginner Level Interview Questions
Intermediate Level Interview Questions
Advanced Level Interview Questions
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Awareness of design smells - indicators of common design problems - helps developers or software engineers understand mistakes made while designing and apply design principles for creating high-quality designs. This presentation provides insights gained from performing refactoring in real-world projects to improve refactoring and reduce the time and costs of managing software projects.
In this whitepaper, LearnItFirst founder Scott Whigham talks about how you can become a good (or better) C# programmer. This whitepaper is long - 15 pages - but it includes both a step-by-step system to follow as well as an in-depth discussion of each step.
If you follow this 13-step system (with a bonus 14th step), you can’t help but become a good C# developer!
YouTube Link: https://youtu.be/ipYKV3U8SyM
**Edureka Online Courses: https://www.edureka.co**
This Edureka PPT on Top 50 C# Interview Question and Answers will help you to prepare yourself for C# developer Interviews. It covers questions for the following levels:
Beginner Level
Intermediate Level
Experienced Professionals
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Virtual staffing process is very much helpful for each & every business, whether it is small or large. This is a very simple process & it delivers the massive benefits
This is a low-level, and philosophical discussion on the act of compiling data out of your PHP applications using Zend\Code: Scanning, Generating, Annotating code in PHP.
Ralph Schindler (of Zend Framework) and Jon Wage (of Doctrine) presented these slides for a webinar hosted by zend.com (webinar available online).
Links are contained within the slides to the demo application that was also used during the webinar.
One reasonable definition of good design is testability. It is hard to imagine a software system that is both testable and poorly designed. It is also hard to imagine a software system that is well designed but also untestable.
I'll talk you through how bad design may affect testability. We will learn how to design robust tests which are not just increasing code coverage but are bringing real value to your project.
Finally we will explore the best way to integrate these tests to your continuous integration environment so they will be acting as top class guards against sloppy commits.
Keywords : design principles, unit tests, integration tests, stress tests, java, spring, junit @Rule, junit @Category, @RunWith, @Parameters, surefire, maven, jenkins, quality metrics, selenium , tdd, mocks, stubs, etc...
Do your unit tests feel like a chore to maintain? Are they sometimes useful but come with a high maintenance cost? Do you secretly believe you’d work faster without them there? A great test suite should help speed up your development process, not slow you down. This talk highlights some techniques you can use to improve the front-end unit tests you write.
Top 50 .NET Interview Questions and Answers 2019 | EdurekaEdureka!
YouTube Link: https://youtu.be/5WwzmjgmqUA
** Microsoft .NET Certification Training: edureka.co/microsoft-dotnet-framework-self-paced **
This Edureka PPT on '.NET Interview Questions and Answers' will help you understand the frequently asked interview questions for .NET. Following are the topics discussed:
Beginner Level Interview Questions
Intermediate Level Interview Questions
Advanced Level Interview Questions
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Awareness of design smells - indicators of common design problems - helps developers or software engineers understand mistakes made while designing and apply design principles for creating high-quality designs. This presentation provides insights gained from performing refactoring in real-world projects to improve refactoring and reduce the time and costs of managing software projects.
In this whitepaper, LearnItFirst founder Scott Whigham talks about how you can become a good (or better) C# programmer. This whitepaper is long - 15 pages - but it includes both a step-by-step system to follow as well as an in-depth discussion of each step.
If you follow this 13-step system (with a bonus 14th step), you can’t help but become a good C# developer!
YouTube Link: https://youtu.be/ipYKV3U8SyM
**Edureka Online Courses: https://www.edureka.co**
This Edureka PPT on Top 50 C# Interview Question and Answers will help you to prepare yourself for C# developer Interviews. It covers questions for the following levels:
Beginner Level
Intermediate Level
Experienced Professionals
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Virtual staffing process is very much helpful for each & every business, whether it is small or large. This is a very simple process & it delivers the massive benefits
This is a low-level, and philosophical discussion on the act of compiling data out of your PHP applications using Zend\Code: Scanning, Generating, Annotating code in PHP.
Ralph Schindler (of Zend Framework) and Jon Wage (of Doctrine) presented these slides for a webinar hosted by zend.com (webinar available online).
Links are contained within the slides to the demo application that was also used during the webinar.
Build software like a bag of marbles, not a castle of LEGO®Hannes Lowette
If you have ever played with LEGO®, you will know that adding, removing or changing features of a completed castle isn’t as easy as it seems. You will have to deconstruct large parts to get to where you want to be, to build it all up again afterwards. Unfortunately, our software is often built the same way. Wouldn’t it be better if our software behaved like a bag of marbles? So you can just add, remove or replace them at will?
Most of us have taken different approaches to building software: a big monolith, a collection of services, a bus architecture, etc. But whatever your large scale architecture is, at the granular level (a single service or host), you will probably still end up with tightly couple code. Adding functionality means making changes to every layer, service or component involved. It gets even harder if you want to enable or disable features for certain deployments: you’ll need to wrap code in feature flags, write custom DB migration scripts, etc. There has to be a better way!
So what if you think of functionality as loose feature assemblies? We can construct our code in such a way that adding a feature is as simple as adding the assembly to your deployment, and removing it is done by just deleting the file. We would open the door for so many scenarios!
In this talk, I will explain how to tackle the following parts of your application to achieve this goal: WebAPI, Entity Framework, Onion Architecture, IoC and database migrations. And most of all, when you would want to do this. Because… ‘it depends’.
Many developers forget about good object-oriented design techniques when developing in SharePoint, most of the time because they get overwhelmed by the framework. Unit testing often gets thrown out of the window, and most of the time the application becomes very tightly coupled to the SharePoint object model. This talk will demonstrate how to overcome these obstacles and build solid SharePoint application code that is much more testable and is easier to maintain.
This presentation is part of one of my webinar in clean code webinar series. The contents are slightly edited to share the information in public domain. In this presentation, I tried to provide detailed introduction to code refactoring practice.
This presentation will be useful for software architects/Managers,developers and QAs. Do share your feedback in comments.
Abstract
The idea of this talk is to help development teams to make correct architectural decisions.
Andrei will highlight the basic architectural principles and show ways to achieve architecture that is good enough to cover the project requirements and evolve in the future.
He will also present several cases from real projects, where wrong, missing, or over-sophisticated architecture decisions really hurt the development teams:
- Painful sharing: do shared modules increase reusability or will be the source of problems?
- Microservices are the solution to every problem!
- Non-extensible extensibility: too sophisticated configuration hurts
- Over fine-grained: incorrect splitting to Microservices can make life even harder as with monolith
- Convey horizontal split: how organizational driven split can jeopardise the architecture
- Model-driven: central responsibility blocks and limits the team
- Cargo cult: blindly following patterns and rule can produce an unmaintainable system
- Freestyle architecture: what happens if teams completely ignore architecture
- Improve with less intelligence: smart endpoint and dumb pipes
Abstract
The idea of this talk is to help development teams to make correct architectural decisions.
Andrei will highlight the basic architectural principles and show ways to achieve architecture that is good enough to cover the project requirements and evolve in the future.
He will also present several cases from real projects, where wrong, missing, or over-sophisticated architecture decisions really hurt the development teams:
- Painful sharing: do shared modules increase reusability or will be the source of problems?
- Microservices are the solution to every problem!
- Non-extensible extensibility: too sophisticated configuration hurts
- Over fine-grained: incorrect splitting to Microservices can make life even harder as with monolith
- Convey horizontal split: how organizational driven split can jeopardise the architecture
- Model-driven: central responsibility blocks and limits the team
- Cargo cult: blindly following patterns and rule can produce an unmaintainable system
- Freestyle architecture: what happens if teams completely ignore architecture
- Improve with less intelligence: smart endpoint and dumb pipes
The first day slides of the Domain Driven Design course that I imparted on Schibsted Spain.
They talk about technical debt, domain modeling, model driven design and SOLID principles.
Zend Framework is widely known as having a "use-at-will" architecture, but what does that really mean? We'll explore two scenarios: one where developers use Zend Framework as a base and extend various components to suite their needs and another where developers can extend nonZF code with ZF components. On conclusion, developers will have a necessary enough understanding to extend with and for ZF.
ZF2 takes a different approach to services; there are several services out there and you should be providing the ability for ZF2 to integrate with this. ZF2 marries services with composer and a different packaging mechanism to ensure that services can be released without a specific framework version. This not only helps the framework but helps you prevent an API changing in between framework releases without having an issue of awaiting a framework release.
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
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/
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:
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
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Welcome to the first live UiPath Community Day Dubai! Join us for this unique occasion to meet our local and global UiPath Community and leaders. You will get a full view of the MEA region's automation landscape and the AI Powered automation technology capabilities of UiPath. Also, hosted by our local partners Marc Ellis, you will enjoy a half-day packed with industry insights and automation peers networking.
📕 Curious on our agenda? Wait no more!
10:00 Welcome note - UiPath Community in Dubai
Lovely Sinha, UiPath Community Chapter Leader, UiPath MVPx3, Hyper-automation Consultant, First Abu Dhabi Bank
10:20 A UiPath cross-region MEA overview
Ashraf El Zarka, VP and Managing Director MEA, UiPath
10:35: Customer Success Journey
Deepthi Deepak, Head of Intelligent Automation CoE, First Abu Dhabi Bank
11:15 The UiPath approach to GenAI with our three principles: improve accuracy, supercharge productivity, and automate more
Boris Krumrey, Global VP, Automation Innovation, UiPath
12:15 To discover how Marc Ellis leverages tech-driven solutions in recruitment and managed services.
Brendan Lingam, Director of Sales and Business Development, Marc Ellis
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
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/
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
2. Who Am I?
•Ralph Schindler (ralphschindler)
Software Engineer on the Zend Framework team
•At Zend for almost 4 years
•Before that TippingPoint/3Com
Programming PHP for 13+ years
Live in New Orleans, LA.
•Lived in Austin, Tx for 5 years
My background with Di
•I was part of the original roundtable 3yr ago @ zendcon
–Fabien + Stephan + Myself
2
4. Dependency Injection
•Subject matter expert: Martin Fowler
not the only one, but has a nice take on it
•http://martinfowler.com/articles/
injection.html
4
5. Di vs. DiC
•Di is a pattern
This is non-negotiable
DI is about Inversion Of Control (IoC)
–sometimes not an easy concept to grasp for
beginner and intermediate developers
•DiC is a tool
Subject to a developer’s or a group of
developers requirements
I.E.: no formal definition
•as such, lots of frameworks provide this in some
way shape or form
5
6. Important Fowler Quote
•“Inversion of control is a common feature
of frameworks, but it's something that
comes at a price. It tends to be hard to
understand and leads to problems when
you are trying to debug. So on the whole I
prefer to avoid it unless I need it. This isn't
to say it's a bad thing, just that I think it
needs to justify itself over the more
straightforward alternative.”
6
8. Di’s Misguided Argument
•Testing
everyone quotes this as the argument for
dependency injection
•correct for silo’d development
•if you are the only consumer of your code
too much emphasis here
8
9. The Better Di Argument
•Makes it easy for developers to swap
out implementation
•Paddy Brady:
... “it helps ensure source code can be
maintained in a highly decoupled state.
Which make it easier to subclass the Zend
Framework to death, and modify it’s
components before use.”
9
10. Di Identified Types
•Constructor
Favored by PicoContainer derivatives
•Setter
Favored by Spring Container derivatives
10
11. Di 3rd Injection Type
•Interface Injection
but first as segue ...
11
12. What is an Interface
•A contract that forces subtypes to conform
to particular method signatures so that
objects can exhibit particular behaviors
12
13. Interfaces
•Interface best practices
No constructors
No static methods
•Why? Because interfaces are about
“alternate implementations”
•PHP allows statics and constructors in
interfaces
for better or worse
13
14. Interfaces explained
•A better way to think about it
Interfaces are about contracts in behavior
between developers
Point in case, search for “friends” in this
page:
•http://martinfowler.com/articles/injection.html
14
16. Back To Interface Injection
•First and foremost: a communication tool
•Form of setter injection (or, injection via
method)
•The dependency is implied by the
interface and the injection point is forced
by the interface
Always part of the type’s hierarchy
•Rely’s on a managing/consuming object/
framework for execution - or a really strict
developer
16
18. Interface Injection Pattern
•Not formal / it is semi-de-facto
•Interface injection is tricker to understand
without context
•(Semi) Well known pattern at play
the “Aware” interface name
18
19. Interface Injection Downside
•At the application layer, it leads to having
to write and consume lots of interfaces to
get things sorted out
19
21. Constructor vs. Setter Injection
•Constructor
Pro: object in ready state
Con: there is a param per dependency
•too busy of an object? or just right?
Con: dependencies are not polymorphic
Pro/Con: dependencies can (not?) be
swappable after instantiation
Pro: object declares complexity up front
Con: can lead to cyclical dependencies
21
22. Constructor vs. Setter Injection
•Constructor continued:
•Constructors are not subject to Liskov Substitution
Principle (Ctor is not part of the type in question)
–In other languages ctors are static
22
23. Constructor vs. Setter Injection
•Setter
Pro: clear injection points for each
dependency
Con: consumer has to be very honest about
injecting all dependencies
Con: construct is not up front about required
dependencies
•hard to distinguish optional vs. required
dependencies
–is this really such a thing?
23
24. Misconceptions?
•(SL) Service Locators !== (DiC) Dependency
Injection Containers
•But DiC == SL
DiC’s can be the foundation of consumed for
service location
24
26. Service Locator
•It is understood that services to be locator
aware
•Pros:
not all code paths in the consuming object
might use all the dependencies
•Example: controller
•Cons:
service locator becomes the dependency
26
29. Why Di For Zend
•Considering a DiC is a first world problem
for developers
•Why did we create this component?
You’re afraid of “new”?
You asked for it
•Having a DI Container that tries to
understand your code makes you code
better
29
30. Questions Raised
•But is it really possible to force developers
to write better code?
•How do we look at a use case and tell if
the DiC is falling short, or the developer is
writing bad code?
There is a fine line
30
31. DiCs Out There - Not PHP
•Java
Spring, PicoContainer
•.net
Spring.Net, StructureMap, Unity, Castle’s
Windsor
31
32. ZendDi perspective
•we support both:
"This issue has led to a lot of debate between
the various teams who provide dependency
injectors as part of their frameworks. However
it seems that most people who build these
frameworks have realized that it's important to
support both mechanisms, even if there's a
preference for one of them."
•-Martin Fowler
32
34. Goals
•Find a way to produce a DiC that works for
PHP developers and all their “tendencies”
very hard to identify
•Performant - as best as possible
we have no persistent memory
•The same or less code required than
actually just writing the code in the first
place
34
35. A Note on DI and Performance
•Di is just code, it is a performant as not
practicing Di
so long as you’re still using the same number
of dependencies/objects
•DiC is not performance friendly!
Front loading workflow, structural needs
NOT Hello World friendly!
35
36. ZendDi Parts
•Two main components
Definition
Instance Configuration
•Runtime concerns
36
37. ZendDi Definition
•Goals
Explain what the code looks like, what it
expects
Identify which classes have dependencies
Identify injection points
Names for all the moving parts
37
39. ZendDi Definition
•From a very fundamental level, injection
always comes in the two forms
Via constructor params
Via method injection
•We (currently) do not support public
property setting
39
40. ZendDi Definition
•Naming dependency/configuration entry
points
Is an object expected? Is there a type hint?
•Where does it originate from?
Is a scalar expected? Is it optional?
40
41. ZendDi Configuration
•Goals
Encapsulate runtime data required to wire
instances
•Could be environment specific (dev. different than
production)
Be able to identify which objects fulfill a
dependency (preferred types)
41
42. Definition & Configuration
•A better understanding:
Definitions can be shipped with your code,
they are independent of how they are used
Configuration is what is expected of anyone
consuming ZendDi
42
43. Building Definitions
•At Runtime (on-demand)
Great for development, terrible for
production, esp. with annotations turned on
•Compiler (Reflection+Scanner)
(yesterday’s talk on ZendCode)
Compiled into an array; used with
ArrayDefinition
•By-Hand
ClassDefinition
BuilderDefinition
43
44. Demo Time
•Live Demo Time
•Code:
https://github.com/ralphschindler/Zend_DI-
Examples
Uses ZF2 Beta Phars
44
45. Other Containers
•Yadif (beberlei)
•Pimple (Fabien Potencier)
•Symfony Di Container for 5.3
•PicoContainer
more than 5 years old
45
46. ZendDi Todo
•Further divorce the Service Locator /
Dependency Injection Container
•Service locators can be defined by
callbacks (closures)
46