SlideShare a Scribd company logo
http://lifetuned.com
                      http://pikpak.me




               Dependency
                 Inversion

@tommysqueak       http://tomphilip.me
About
•   Dependency Injection
•   Service Location
•   TDD & Mocking - How they play together nicely
•   Auto-mocking
•   IOC - Tools, Features, Usage, Pros/Cons, Best
    Practice
Dependency Inversion Principle
Definition
•   High-level modules should not depend
    on low-level modules. Both should
    depend on abstractions.
•   Abstractions should not depend upon
    details. Details should depend upon
    abstractions.
Design Patterns
Dependency Injection

  Service Locator
Story
As a Customer
I want to change my password
In order to keep my account secure
Scenario
Given I’m an account holder
When I change my password
Then It should ensure it is a strong password
And it should change my password
And it should notify me it has been changed
Demo
Benefits
•   Loose coupling
•   Re-use
•   Testability
Inversion of Control
Provide
Dependency Injection

  Service Locator
Usage
•   Registration
•   Entry Point
Demo
Frameworks
•AutoFac
• NInject
• Castle Windsor
• StructureMap
• Unity
How They Look
A Little Best Practice
•   Internal code should not reference
    the container directly
•   Verify registration with tests
• Constructor Injection over Setter
    Injection over Service Location
Picture Credits
•   http://www.flickr.com/        •   http://www.flickr.com/
    photos/smil/4196304056/ -         photos/gcwest/
    Patterns                          281385801/ - containers
•   http://lostechies.com/
    derickbailey/2009/02/11/
    solid-development-
    principles-in-motivational-
    pictures/ - SOLID pictures
•   http://www.flickr.com/
    photos/kevindean/
    4031083510/ - trolley

More Related Content

PDF
Ember App Kit & The Ember Resolver
PDF
Testable Requirements
KEY
Rails Performance Tricks and Treats
PDF
Great Software Design
PPT
Goals Of Software Design - The main goals
PPTX
Understanding Business Model Canvas
PPTX
Busıness Model Innovation Business Model Canvas Toolbox 2016
PDF
Business Model Canvas Workshop at Startup Pirates @ Bratislava
Ember App Kit & The Ember Resolver
Testable Requirements
Rails Performance Tricks and Treats
Great Software Design
Goals Of Software Design - The main goals
Understanding Business Model Canvas
Busıness Model Innovation Business Model Canvas Toolbox 2016
Business Model Canvas Workshop at Startup Pirates @ Bratislava

Viewers also liked (16)

PPTX
Business Model Generation: Business Model Canvas + Design Thinking
PDF
Overview of Business Model Canvas Tools
PPTX
Innovation & Business Model & Business Model Canvas 2014
PDF
20150216 design thinking dans l'éducation
PPT
Business Model Canvas (Dr. Htet Zan Linn)
PDF
Overview of business model canvas tools
PDF
Business Model Canvas Poster Deutsch V 1.1
PPTX
Leading and Managing Change [Change Management]
PDF
(Pre) Accelerate towards the future!
PDF
Design Thinking and the Business Model Canvas for the Mobile Economy
PDF
Business model Canvas
PDF
How To Design A Good A P I And Why It Matters G O O G L E
PPTX
OOP Principles
PDF
Business Model Canvas
PDF
Business Model Canvas
PDF
Business Model Websites Canvas Poster- format Checkliste
Business Model Generation: Business Model Canvas + Design Thinking
Overview of Business Model Canvas Tools
Innovation & Business Model & Business Model Canvas 2014
20150216 design thinking dans l'éducation
Business Model Canvas (Dr. Htet Zan Linn)
Overview of business model canvas tools
Business Model Canvas Poster Deutsch V 1.1
Leading and Managing Change [Change Management]
(Pre) Accelerate towards the future!
Design Thinking and the Business Model Canvas for the Mobile Economy
Business model Canvas
How To Design A Good A P I And Why It Matters G O O G L E
OOP Principles
Business Model Canvas
Business Model Canvas
Business Model Websites Canvas Poster- format Checkliste
Ad

Similar to Dependency Inversion Principle (20)

PDF
20181025 integration reloaded_integration_solutions_based_on_reactive_principles
PDF
Integration Reloaded - Integration solutions based on reactive principles
PPTX
ASP.NET MVC - Latest & Greatest So Far
PDF
Governance and Security Solution Patterns
PPT
SQL: Permissions and Data Protection
PPTX
8 cloud design patterns you ought to know - Update Conference 2018
PDF
Patterns and practices for building enterprise-scale HTML5 apps
PPTX
Augmented Reality based Product Identification and Advertising System - Final...
PPTX
Architectural Considerations for Startups
PDF
Trunk-Based Development and Toggling
PPTX
The Dependency Injection - Sorin Damian, Software Developer@RomSoft
PPTX
Cloud Design Patterns - Hong Kong Codeaholics
PPTX
RubyConf 2012: Custom Reverse Proxies
PPTX
JavaScript in Universal Windows Platform apps
PPTX
Oracle licensing rules the 5 fatal mistakes
PDF
Opportunities for the Stock Photo and Microstock Industry
PPTX
Writing Testable Code in SharePoint
PDF
Integrating multiple CDNs at Etsy
PPTX
Code Palousa presentation- "Giving Digital Eyes to your Synthetic Tests"
PPS
Ng Sydney Dynamic Templates Talk - 18 April 2018
20181025 integration reloaded_integration_solutions_based_on_reactive_principles
Integration Reloaded - Integration solutions based on reactive principles
ASP.NET MVC - Latest & Greatest So Far
Governance and Security Solution Patterns
SQL: Permissions and Data Protection
8 cloud design patterns you ought to know - Update Conference 2018
Patterns and practices for building enterprise-scale HTML5 apps
Augmented Reality based Product Identification and Advertising System - Final...
Architectural Considerations for Startups
Trunk-Based Development and Toggling
The Dependency Injection - Sorin Damian, Software Developer@RomSoft
Cloud Design Patterns - Hong Kong Codeaholics
RubyConf 2012: Custom Reverse Proxies
JavaScript in Universal Windows Platform apps
Oracle licensing rules the 5 fatal mistakes
Opportunities for the Stock Photo and Microstock Industry
Writing Testable Code in SharePoint
Integrating multiple CDNs at Etsy
Code Palousa presentation- "Giving Digital Eyes to your Synthetic Tests"
Ng Sydney Dynamic Templates Talk - 18 April 2018
Ad

Recently uploaded (20)

PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Getting Started with Data Integration: FME Form 101
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A comparative analysis of optical character recognition models for extracting...
Heart disease approach using modified random forest and particle swarm optimi...
Getting Started with Data Integration: FME Form 101
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
Assigned Numbers - 2025 - Bluetooth® Document
TLE Review Electricity (Electricity).pptx
1. Introduction to Computer Programming.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Zenith AI: Advanced Artificial Intelligence
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Unlocking AI with Model Context Protocol (MCP)
A novel scalable deep ensemble learning framework for big data classification...
NewMind AI Weekly Chronicles - August'25-Week II
Enhancing emotion recognition model for a student engagement use case through...
Accuracy of neural networks in brain wave diagnosis of schizophrenia

Dependency Inversion Principle

  • 1. http://lifetuned.com http://pikpak.me Dependency Inversion @tommysqueak http://tomphilip.me
  • 2. About • Dependency Injection • Service Location • TDD & Mocking - How they play together nicely • Auto-mocking • IOC - Tools, Features, Usage, Pros/Cons, Best Practice
  • 4. Definition • High-level modules should not depend on low-level modules. Both should depend on abstractions. • Abstractions should not depend upon details. Details should depend upon abstractions.
  • 6. Story As a Customer I want to change my password In order to keep my account secure Scenario Given I’m an account holder When I change my password Then It should ensure it is a strong password And it should change my password And it should notify me it has been changed
  • 8. Benefits • Loose coupling • Re-use • Testability
  • 10. Provide Dependency Injection Service Locator
  • 11. Usage • Registration • Entry Point
  • 12. Demo
  • 13. Frameworks •AutoFac • NInject • Castle Windsor • StructureMap • Unity
  • 15. A Little Best Practice • Internal code should not reference the container directly • Verify registration with tests • Constructor Injection over Setter Injection over Service Location
  • 16. Picture Credits • http://www.flickr.com/ • http://www.flickr.com/ photos/smil/4196304056/ - photos/gcwest/ Patterns 281385801/ - containers • http://lostechies.com/ derickbailey/2009/02/11/ solid-development- principles-in-motivational- pictures/ - SOLID pictures • http://www.flickr.com/ photos/kevindean/ 4031083510/ - trolley