SlideShare a Scribd company logo
Provider Pattern
practices
MINH NGUYEN
@LINKNODE SEPTEMBER, 2015
Object-Oriented Programming
23 Design Patterns5 Principles
Single responsibility
Open/closed
Liskov substitution
Integrated segregation
Dependency inversion
Software Architecture
3-tier
MVC
MVP
MVVM
….
Open-closed principle
“Software modules should be closed for modifications but open for extensions.”
Sample use case:
Requirements: VentusAR needs to supply a new model type: SolarPanel
Current action: Have to modify all existing code everywhere to support this new type
string message= “”;
if (type = “Wind”)
{
message = “Turbine is spinning”;
}
else if (type = “SolarPanel”)
{
message = “Solar panel is under the sun”;
}
else if ….
else if ….
else if ….
Violate Open-closed principle
(having to modify existing code to be able to add new feature)
Inspired by Factory Pattern
VentusModel
+ getMessage()
Turbine
+ getMessage()
SolarPanel
+ getMessage()
Transmission
+ getMessage()
VentusModelFactory
+ getInstant(name)
creates
Client
asks
products
Provider Pattern (Microsoft 2002)
* Mimic Plug-in/ Add-on architecture
* Do not have to modify existing code
* Just supply additional separate class
* Configure from external settings (config file, database,)
Create instant from string
+ External Settings
Provider pattern
From XML:
From Database:
string
string
* Supply a new Transmission model to the app without modifying code
Demo
Provider Pattern vs Factory Pattern ?
* In-code config
* Still have to modify existing code
* Configure easily from external settings (using .Net Reflection)
* Do not have to modify existing code
Q&A

More Related Content

PPT
Layers of Smalltalk Application
PPTX
Creating and destroying objects
PPT
Model View ViewModel
PDF
Desiging for Modularity with Java 9
DOCX
Generic Repository Pattern in MVC3 Application with Entity Framework
PPT
Backbonejs
PPT
Software Design Patterns
DOCX
Patterns (contd)Software Development ProcessDesign patte.docx
Layers of Smalltalk Application
Creating and destroying objects
Model View ViewModel
Desiging for Modularity with Java 9
Generic Repository Pattern in MVC3 Application with Entity Framework
Backbonejs
Software Design Patterns
Patterns (contd)Software Development ProcessDesign patte.docx

Similar to Provider pattern practices (20)

PPTX
OpenDaylight app development tutorial
PPTX
My perspective on MVP and architecture discussions
PPTX
Developing Loosely Coupled Modules with Magento
PPT
Design pattern
PDF
Skroutz Android MVP and Adapter Delegates presentation
PPT
P Training Presentation
PPTX
Building an enterprise app in silverlight 4 and NHibernate
PDF
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
PPTX
Caliburn.micro
PPTX
Design pattern-presentation
PDF
Portable Class Libraries and MVVM
PPTX
Sitecore MVC (London User Group, April 29th 2014)
PPTX
Sitecore MVC (User Group Conference, May 23rd 2014)
PDF
Principles of MVC for PHP Developers
PPT
Introduction to design_patterns
PPTX
Windows AI Platform & the Intelligent Edge (pptx)
PPTX
1. Mini seminar intro
PPTX
What's new in asp.net mvc 4
PPT
lecture10-patterns.ppt
PPT
lecture10-patterns.ppt
OpenDaylight app development tutorial
My perspective on MVP and architecture discussions
Developing Loosely Coupled Modules with Magento
Design pattern
Skroutz Android MVP and Adapter Delegates presentation
P Training Presentation
Building an enterprise app in silverlight 4 and NHibernate
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
Caliburn.micro
Design pattern-presentation
Portable Class Libraries and MVVM
Sitecore MVC (London User Group, April 29th 2014)
Sitecore MVC (User Group Conference, May 23rd 2014)
Principles of MVC for PHP Developers
Introduction to design_patterns
Windows AI Platform & the Intelligent Edge (pptx)
1. Mini seminar intro
What's new in asp.net mvc 4
lecture10-patterns.ppt
lecture10-patterns.ppt
Ad

More from Minh Ng (6)

PPTX
3D Scanning & Reconstruction with Kinect
PPTX
WebGL - 3D programming
PPTX
SignalR tutorial & best practices
PPTX
Open Data practices
PPTX
Entity framework practices
PPTX
Monogame Content Pipeline practices
3D Scanning & Reconstruction with Kinect
WebGL - 3D programming
SignalR tutorial & best practices
Open Data practices
Entity framework practices
Monogame Content Pipeline practices
Ad

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
A comparative analysis of optical character recognition models for extracting...
Review of recent advances in non-invasive hemoglobin estimation
Building Integrated photovoltaic BIPV_UPV.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Spectroscopy.pptx food analysis technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation_ Review paper, used for researhc scholars
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Empathic Computing: Creating Shared Understanding
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
sap open course for s4hana steps from ECC to s4
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
A comparative analysis of optical character recognition models for extracting...

Provider pattern practices

  • 2. Object-Oriented Programming 23 Design Patterns5 Principles Single responsibility Open/closed Liskov substitution Integrated segregation Dependency inversion Software Architecture 3-tier MVC MVP MVVM ….
  • 3. Open-closed principle “Software modules should be closed for modifications but open for extensions.” Sample use case: Requirements: VentusAR needs to supply a new model type: SolarPanel Current action: Have to modify all existing code everywhere to support this new type string message= “”; if (type = “Wind”) { message = “Turbine is spinning”; } else if (type = “SolarPanel”) { message = “Solar panel is under the sun”; } else if …. else if …. else if …. Violate Open-closed principle (having to modify existing code to be able to add new feature)
  • 4. Inspired by Factory Pattern VentusModel + getMessage() Turbine + getMessage() SolarPanel + getMessage() Transmission + getMessage() VentusModelFactory + getInstant(name) creates Client asks products
  • 5. Provider Pattern (Microsoft 2002) * Mimic Plug-in/ Add-on architecture * Do not have to modify existing code * Just supply additional separate class * Configure from external settings (config file, database,) Create instant from string
  • 6. + External Settings Provider pattern From XML: From Database: string string
  • 7. * Supply a new Transmission model to the app without modifying code Demo
  • 8. Provider Pattern vs Factory Pattern ? * In-code config * Still have to modify existing code * Configure easily from external settings (using .Net Reflection) * Do not have to modify existing code
  • 9. Q&A