Hi,
The services, talked here, are things used in IServiceContainer,
IServiceProvider, etc.
The term "Service" and "Provider", as in IServiceProvider, refer to specific design patterns (as does "Container", which is
self-explanatory IMO).
ServiceInterface pattern:
http://patternshare.org/default.aspx/Home.PP.ServiceInterface
The provider pattern decouples a service's implementation with the mechanisms for discovery and consumption. I can't find a
reference to this pattern on patternshare.org. Maybe someone else has links they could mention.
In my opinion, everything can be a service, and a service is generally
used for providing specific features for service consumers, at design
time.
Many things that aren't commonly referred to as services can be thought of as services, but actually referring to them as services
would create ambiguity when used out of context. For instance, you don't normally call an object's methods, "services" unless you
are creating a logical design. The term "service" is probably overused anyway, but here we are referring to a specific design
pattern.
You can also use these design patterns, as well as the actual interfaces, at runtime. From the perspective of the VS.NET
development team, their application uses them at runtime. You could use these patterns as well in your own applications. You get
some basic support for services in your own applications just by deriving a class from System.ComponentModel.Component. Web
services are another example of services being consumed at runtime. There are many, many more examples.
But, I think the cnsumers must completely know all aspects of
that service. This sounds not good, and breaks the decoupling rule.
I don't think a consumer must know all aspects of a service that it consumes, otherwise it would break encapsulation. A service
could very well implement multiple service interfaces if they must share data. The consumer need only be concerned with the
interface on which it's performing it's work.
As for breaking the "decoupling rule", I think the service pattern intends to do just the opposite by creating a loose coupling
between the service implementation and the applications that use it, unless you are referring to a rule of which I'm unaware. I'm
referring to the notion that loose coupling of components is generally better.
So how to understand the role of Service, in a software engineering
perspective.
Thx in advance.
Review design patterns and gather experience if you don't understand them.