SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Creating a Plug-in
Architecture
in .NET
ONDREJ BALAS @ONDREJBALAS
WWW.ONDREJBALAS.COM
ONDREJ@ONDREJBALAS.COM
ONDREJ BALAS
Microsoft MVP in .NET
Writer for Visual Studio Magazine
Owner of UseTech Design (est. 2001)
Building software that drives business
W W W.OND REJBALAS.COM
OND REJ@OND REJBALA S.COM
@ OND REJBALAS
• An external piece of functionality that may be
added to an existing system by abiding by a
contract pre-defined by that system.
Plug-in (my definition)
• Split work across natural boundaries
• Incrementally create and deploy features
• Deploy only new and updated modules
• Don’t need source code for existing
system
• Changes to contracts are difficult to
manage
• Increased development time for
small projects
// Get input – “HELLO”
string input = Console.ReadLine().ToUpper();
// "Encrypt" it
string output = "";
foreach (char c in input)
{
byte b = (byte) c;
output += (char)(b < 78 ? b + 13 : b - 13);
}
// Write output – “URYYB”
Console.WriteLine(output);
Tightly Coupled Code
static void Main(string[] args) {
// Get input
string input = Console.ReadLine().ToUpper();
// "Encrypt" it
Rot13 encryptionAlgorithm = new Rot13();
string output = encryptionAlgorithm.Encrypt(input);
// Write output
Console.WriteLine(output);
}
public class Rot13 {
public string Encrypt(string input)
{
string output = "";
foreach (char c in input)
{
output += (char)(c < 78 ? c + 13 : c - 13);
}
return output;
}
}
static void Main(string[] args) {
// Get input
string input = Console.ReadLine().ToUpper();
// "Encrypt" it
IEncryptionAlgorithm encryptionAlgorithm = new Rot13();
string output = encryptionAlgorithm.Encrypt(input);
// Write output
Console.WriteLine(output);
}
public class Rot13 : IEncryptionAlgorithm {
public string Encrypt(string input)
{
string output = "";
foreach (char c in input)
{
output += (char)(c < 78 ? c + 13 : c - 13);
}
return output;
}
}
public interface IEncryptionAlgorithm
{
string Encrypt(string input);
}
Decoupled
Code
• Single - Automatically choose one.
• One of Many - Like Single, but give the user
the choice. Think smart phone apps
• Many Simultaneously – Using the composite
pattern, many plug-ins are treated as one. Like
browser plug-ins; they have the potential of
overlapping
• Most IoC containers
– Ninject (using ninject.extensions.conventions)
– Castle.Windsor
– Unity
– StructureMap
– MEF – Managed Extensibility Framework
– MAF – Managed AddIn Framework
– Many other IoC containers
Add Sales Tax
to Calculation
Toppings!
More Toppings!
• Why not use config files? Config files are for
changing the data/data source. Plug-in
architecture is for dropping in functionality
• Deciding where to put plug-in points
• Recovering from plug-in crashes
• Dynamic loading and unloading at run time
• Updating an application while it’s running
Thanks!
ONDREJ BALAS @ONDREJBALAS
WWW.ONDREJBALAS.COM
ONDREJ@ONDREJBALAS.COM
@ONDREJBALAS
GITHUB.COM/ONDREJBALAS

Weitere ähnliche Inhalte

Was ist angesagt?

Benefits of developing single page web applications using angular js
Benefits of developing single page web applications using angular jsBenefits of developing single page web applications using angular js
Benefits of developing single page web applications using angular js
Harbinger Systems - HRTech Builder of Choice
 
Api gateway in microservices
Api gateway in microservicesApi gateway in microservices
Api gateway in microservices
Kunal Hire
 

Was ist angesagt? (20)

Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
Introduction to Kong API Gateway
Introduction to Kong API GatewayIntroduction to Kong API Gateway
Introduction to Kong API Gateway
 
Snyk Intro - Developer Security Essentials 2022
Snyk Intro - Developer Security Essentials 2022Snyk Intro - Developer Security Essentials 2022
Snyk Intro - Developer Security Essentials 2022
 
Monitoring &amp; alerting presentation sabin&amp;mustafa
Monitoring &amp; alerting presentation sabin&amp;mustafaMonitoring &amp; alerting presentation sabin&amp;mustafa
Monitoring &amp; alerting presentation sabin&amp;mustafa
 
Spring cloud for microservices architecture
Spring cloud for microservices architectureSpring cloud for microservices architecture
Spring cloud for microservices architecture
 
API 101 - Understanding APIs
API 101 - Understanding APIsAPI 101 - Understanding APIs
API 101 - Understanding APIs
 
How to migrate an application in IBM APIc, and preserve its client credential
How to migrate an application in IBM APIc, and preserve its client credentialHow to migrate an application in IBM APIc, and preserve its client credential
How to migrate an application in IBM APIc, and preserve its client credential
 
Fuse overview
Fuse overviewFuse overview
Fuse overview
 
What is Angular?
What is Angular?What is Angular?
What is Angular?
 
Introduction to DevSecOps
Introduction to DevSecOpsIntroduction to DevSecOps
Introduction to DevSecOps
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Benefits of developing single page web applications using angular js
Benefits of developing single page web applications using angular jsBenefits of developing single page web applications using angular js
Benefits of developing single page web applications using angular js
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Camel Day Italy 2021 - What's new in Camel 3
Camel Day Italy 2021 - What's new in Camel 3Camel Day Italy 2021 - What's new in Camel 3
Camel Day Italy 2021 - What's new in Camel 3
 
Grails Jasypt Encryption Plugin
Grails Jasypt Encryption PluginGrails Jasypt Encryption Plugin
Grails Jasypt Encryption Plugin
 
AWS Cloud Experience CA: Desplegando y Desarrollando Aplicaciones Modernas en...
AWS Cloud Experience CA: Desplegando y Desarrollando Aplicaciones Modernas en...AWS Cloud Experience CA: Desplegando y Desarrollando Aplicaciones Modernas en...
AWS Cloud Experience CA: Desplegando y Desarrollando Aplicaciones Modernas en...
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
Jenkins
JenkinsJenkins
Jenkins
 
Api gateway in microservices
Api gateway in microservicesApi gateway in microservices
Api gateway in microservices
 

Andere mochten auch

Building an Eclipse plugin to recommend changes to developers
Building an Eclipse plugin to recommend changes to developersBuilding an Eclipse plugin to recommend changes to developers
Building an Eclipse plugin to recommend changes to developers
kim.mens
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
benalman
 
Building GPE: What We Learned
Building GPE: What We LearnedBuilding GPE: What We Learned
Building GPE: What We Learned
rajeevdayal
 

Andere mochten auch (14)

Plugin architecture (Extensible Application Architecture)
Plugin architecture (Extensible Application Architecture)Plugin architecture (Extensible Application Architecture)
Plugin architecture (Extensible Application Architecture)
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin Development
 
Building an Eclipse plugin to recommend changes to developers
Building an Eclipse plugin to recommend changes to developersBuilding an Eclipse plugin to recommend changes to developers
Building an Eclipse plugin to recommend changes to developers
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
 
Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)
 
So, you want to be a plugin developer?
So, you want to be a plugin developer?So, you want to be a plugin developer?
So, you want to be a plugin developer?
 
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
 
A Simple Plugin Architecture for Wicket
A Simple Plugin Architecture for WicketA Simple Plugin Architecture for Wicket
A Simple Plugin Architecture for Wicket
 
Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design Patterns
 
Eclipse Overview
Eclipse Overview Eclipse Overview
Eclipse Overview
 
Building GPE: What We Learned
Building GPE: What We LearnedBuilding GPE: What We Learned
Building GPE: What We Learned
 
Configuration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL PluginConfiguration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL Plugin
 

Ähnlich wie Creating a Plug-In Architecture

Basic html5 and javascript
Basic html5 and javascriptBasic html5 and javascript
Basic html5 and javascript
wendy017
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
維佋 唐
 

Ähnlich wie Creating a Plug-In Architecture (20)

How to lock a Python in a cage? Managing Python environment inside an R project
How to lock a Python in a cage?  Managing Python environment inside an R projectHow to lock a Python in a cage?  Managing Python environment inside an R project
How to lock a Python in a cage? Managing Python environment inside an R project
 
Basic html5 and javascript
Basic html5 and javascriptBasic html5 and javascript
Basic html5 and javascript
 
Typhoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitTyphoon Managed Execution Toolkit
Typhoon Managed Execution Toolkit
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta
 
Future-proof Development for Classic SharePoint
Future-proof Development for Classic SharePointFuture-proof Development for Classic SharePoint
Future-proof Development for Classic SharePoint
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Hidden Dragons of CGO
Hidden Dragons of CGOHidden Dragons of CGO
Hidden Dragons of CGO
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)
 
Node azure
Node azureNode azure
Node azure
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
Get together on getting more out of typescript &amp; angular 2
Get together on getting more out of typescript &amp; angular 2Get together on getting more out of typescript &amp; angular 2
Get together on getting more out of typescript &amp; angular 2
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Fp201 unit2 1
Fp201 unit2 1Fp201 unit2 1
Fp201 unit2 1
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 

Mehr von ondrejbalas

Mehr von ondrejbalas (7)

Power BI - Data from any Source
Power BI - Data from any SourcePower BI - Data from any Source
Power BI - Data from any Source
 
Open Source Game Development in C#
Open Source Game Development in C#Open Source Game Development in C#
Open Source Game Development in C#
 
Game Jams - Yum!
Game Jams - Yum!Game Jams - Yum!
Game Jams - Yum!
 
Creating scalable solutions with aws
Creating scalable solutions with awsCreating scalable solutions with aws
Creating scalable solutions with aws
 
Identity in ASP.NET Core
Identity in ASP.NET CoreIdentity in ASP.NET Core
Identity in ASP.NET Core
 
Monetize yourself
Monetize yourselfMonetize yourself
Monetize yourself
 
ReSharper: Discover the Secrets
ReSharper: Discover the SecretsReSharper: Discover the Secrets
ReSharper: Discover the Secrets
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Creating a Plug-In Architecture

  • 1. Creating a Plug-in Architecture in .NET ONDREJ BALAS @ONDREJBALAS WWW.ONDREJBALAS.COM ONDREJ@ONDREJBALAS.COM
  • 2. ONDREJ BALAS Microsoft MVP in .NET Writer for Visual Studio Magazine Owner of UseTech Design (est. 2001) Building software that drives business W W W.OND REJBALAS.COM OND REJ@OND REJBALA S.COM @ OND REJBALAS
  • 3.
  • 4. • An external piece of functionality that may be added to an existing system by abiding by a contract pre-defined by that system. Plug-in (my definition)
  • 5.
  • 6.
  • 7.
  • 8. • Split work across natural boundaries • Incrementally create and deploy features • Deploy only new and updated modules • Don’t need source code for existing system
  • 9.
  • 10.
  • 11. • Changes to contracts are difficult to manage • Increased development time for small projects
  • 12.
  • 13. // Get input – “HELLO” string input = Console.ReadLine().ToUpper(); // "Encrypt" it string output = ""; foreach (char c in input) { byte b = (byte) c; output += (char)(b < 78 ? b + 13 : b - 13); } // Write output – “URYYB” Console.WriteLine(output);
  • 15. static void Main(string[] args) { // Get input string input = Console.ReadLine().ToUpper(); // "Encrypt" it Rot13 encryptionAlgorithm = new Rot13(); string output = encryptionAlgorithm.Encrypt(input); // Write output Console.WriteLine(output); } public class Rot13 { public string Encrypt(string input) { string output = ""; foreach (char c in input) { output += (char)(c < 78 ? c + 13 : c - 13); } return output; } }
  • 16. static void Main(string[] args) { // Get input string input = Console.ReadLine().ToUpper(); // "Encrypt" it IEncryptionAlgorithm encryptionAlgorithm = new Rot13(); string output = encryptionAlgorithm.Encrypt(input); // Write output Console.WriteLine(output); } public class Rot13 : IEncryptionAlgorithm { public string Encrypt(string input) { string output = ""; foreach (char c in input) { output += (char)(c < 78 ? c + 13 : c - 13); } return output; } } public interface IEncryptionAlgorithm { string Encrypt(string input); }
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. • Single - Automatically choose one. • One of Many - Like Single, but give the user the choice. Think smart phone apps • Many Simultaneously – Using the composite pattern, many plug-ins are treated as one. Like browser plug-ins; they have the potential of overlapping
  • 26. • Most IoC containers – Ninject (using ninject.extensions.conventions) – Castle.Windsor – Unity – StructureMap – MEF – Managed Extensibility Framework – MAF – Managed AddIn Framework – Many other IoC containers
  • 27.
  • 28. Add Sales Tax to Calculation Toppings! More Toppings!
  • 29.
  • 30.
  • 31.
  • 32. • Why not use config files? Config files are for changing the data/data source. Plug-in architecture is for dropping in functionality • Deciding where to put plug-in points
  • 33. • Recovering from plug-in crashes • Dynamic loading and unloading at run time • Updating an application while it’s running

Hinweis der Redaktion

  1. The icons use FontAwesome. If they appear to be missing, try installing the font from here: http://fortawesome.github.io/Font-Awesome/ As you may have guessed, this talk is about plug-in architectures in .NET.
  2. Whenever you talk about plugin architectures, the canonical example is this: our electrical system. It’s a great example because you can plug things into it without affecting other devices plugged into the same system. It also represents a common standard that vendors can comply with.
  3. My definition. Read it.
  4. After this slide, jump into example 4-ConsoleEncrypter
  5. After this slide, jump into example 5-CompositionRoot and 6-IoCContainer
  6. Mention the real application that I put into production based on this sample code