The Provider Model: Usage Guidelines
Ryan Whitaker wants you all to stop the Provider Model madness that apparently is about to explode. Kinda funny. A preventative strike against Provider Terror throughout the world. Heh.
I do agree with him on the specific point he makes. You should not use the Provider Model for unnecessary extensibility. What extensibility would be unnecessary? Well, as Ryan states, the off-chance that you'll swicth from using one third-party component to another. Remember, you CAN have too much of a good thing.
Here is a guide to determining when you SHOULD implement the Provider Model for an application subsystem:
- If the subsystem is part of a workflow that is anticipated to change often enough that the application will have to be frequently redeployed.
- If the app specs require the subsystem to be able to process information through multiple channels simultaneously. For example, you need to send an order out to multiple vendors, three of which use distinctly separate web services, and one uses e-mail.
- If the app specs require public third-party extensibility, meaning that end-users need to be able to write their own providers.
So when shouldn't you use the Provider Model? That's an easy one:
- Data Access Layers. DO NOT use the Provider Model to write data access logic. ADO.NET 2.0 has built-in capabilities for that. I will post code demonstrating this at a later date. UPDATE: There are some exceptions to this rule, which I will discuss later next week.
- Utility apps. If you're the only one that is ever going to use the program, there is no sense in investing the time necessary to construct a well-designed Provider Model architecture.
- Component-swapping. Back to what Ryan said before.... just don't do it.
- Because everyone else is doing it. Come on. Be an architect. Think your design out, and only use it if it makes sense to.
More Provider Model-related news coming shortly... stay tuned.