The document discusses creating a plug-in architecture in .NET. It defines a plug-in as an external piece of functionality that can be added to a system by following a predefined contract. Developing with a plug-in architecture allows splitting work across boundaries, incremental feature deployment, and only deploying updated modules without source access. Challenges include managing contract changes and increased development time for small projects.
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);
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
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
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.
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.
My definition. Read it.
After this slide, jump into example 4-ConsoleEncrypter
After this slide, jump into example 5-CompositionRoot and 6-IoCContainer
Mention the real application that I put into production based on this sample code