SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Tendances (20)

Spring Boot
Spring BootSpring Boot
Spring Boot
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
DevSecOps: Key Controls to Modern Security Success
DevSecOps: Key Controls to Modern Security SuccessDevSecOps: Key Controls to Modern Security Success
DevSecOps: Key Controls to Modern Security Success
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
 
Splunking the JVM
Splunking the JVMSplunking the JVM
Splunking the JVM
 
REST API Best (Recommended) Practices
REST API Best (Recommended) PracticesREST API Best (Recommended) Practices
REST API Best (Recommended) Practices
 
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
 
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
 
Engage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-RedEngage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-Red
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
 
devops
devops devops
devops
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICD
 
Getting Started with Infrastructure as Code
Getting Started with Infrastructure as CodeGetting Started with Infrastructure as Code
Getting Started with Infrastructure as Code
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Pulumi - IaC tool
Pulumi - IaC toolPulumi - IaC tool
Pulumi - IaC tool
 
Summit Australia 2019 - PowerApps Component Framework (PCF) - Andrew Ly & Aun...
Summit Australia 2019 - PowerApps Component Framework (PCF) - Andrew Ly & Aun...Summit Australia 2019 - PowerApps Component Framework (PCF) - Andrew Ly & Aun...
Summit Australia 2019 - PowerApps Component Framework (PCF) - Andrew Ly & Aun...
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOps
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean Architecture
 

En vedette

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
 

En vedette (13)

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
 

Similaire à 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
維佋 唐
 

Similaire à 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
 

Plus de ondrejbalas

Plus de 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
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

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

Notes de l'éditeur

  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