(转)提供者模式和策略模式
https://www.cnblogs.com/chucklu/p/4495527.html
However, I still can see a few differences between strategy pattern and provider pattern.
然而,我始终可以发现策略模式和提供者模式之间的区别。
Strategy pattern is a Generic concept, not sticking to a specific technology or global scenarios, but provider pattern in most cases is a configurable service, provided by external source, that you can plug-in to your application, or you may extend this service to create your own custom service, then plug-in to your application.
策略模式是一个泛型的概念。没有和特定的技术或全局的情境绑定。但是提供者模式在大多数情况下是一个可配置的服务,由外部资源提供。你可以将它插入你的应用。或者你可以扩展服务来创建你自定义的服务,然后在插入到你的应用中。
The service provider should have the same features or contract, that is defined in the base class as contract, but with different behaviors, different formats or different connectivity like using web services, database(s) or XML files or streams.
服务提供者应该有相同的功能或者契约,这需要在基类中作为契约来定义,但是有不同的行为,形式,或连通度像web服务、数据库、或者xml文件或流。