tags:

views:

45

answers:

1

Sorry if this is a silly question but I am a C developer who just happen to be in a meeting with a bunch of .NET guys and over heard their conversation.

They were sketching out a design and constantly talk of service provider, services and spring. Instead of looking silly by asking them, I just decided to post here.

BTW, I am doing device driver development (have been for more than 10 years using C) and NEVER heard of service provider.

+1  A: 

If it was mentioned in the context of Spring, then most likely they were talking about the Service Locator Pattern.

The Service Locator is a concept in Dependency Injection frameworks; it's the "kernel" you can use to obtain abstract services of an arbitrary type. Usually with some code like this:

IMyService myService = locator.GetService<IMyService>();

In other words, it provides a special interface for components to gain access to an abstract service - usually an interface type - without knowing anything about the concrete type or how it's instantiated.

Aaronaught
Wow. Seems like C and C# are indeed a world apart :)
Joey
@Joey: Of course. Even C# and C++ are worlds apart; C# and C are galaxies apart. :P You'll find Dependency Injection concepts to be more common in managed languages that support Reflection, which is usually a prerequisite. I don't imagine that it's done too often in C.
Aaronaught
Unsurprisingly, service providers are not at all new to .NET and in fact the IServiceProvider interface was available in COM (good old fashioned unmanaged COM) long before .NET. http://msdn.microsoft.com/en-us/library/cc678965(VS.85).aspx
Josh Einstein
@Josh: I was very careful *not* to say that the concept is new to .NET, or to managed languages in general. Just that it's not *common* in typical Win32 code. This happens to be possible in COM because of the baked-in GUIDs.
Aaronaught