Alex Rivera | Logout

What is concrete implementation?

Asked 2010-06-23T09:25:10.223
21

I saw lot of posts in StackOverflow and elsewhere talking about concrete implementation. While fiddling with WCF i came through the line

Tying your service implementation, or any “service based” class to a concrete implementation is never a good idea.

Can anyone explain what Concrete Implementation is?

Edit
Report

1 Answer

16

It is implementation of something abstract (abstract class, interface). Note that you can instantiate only objects of concrete classes.

Just for example if you have :

abstract class AbstractClass
{
    .......
   // Here you have some abstract methods 
}

class ConcreteClass : AbstractClass
{
.......
}

In case of WCF it wants to say that although it is allowed to mark classes with ServiceContract attribute better to have it on separate Interface and implement that interface in concrete class marked with ServiceBehavior attribute.

Like this :

[ServiceContract(Namespace = "MyNamespaceName")]
interface IMyInterface
{
    [OperationContract]
    int SomeMethod(.....);

   ......    
   ......    
}

[ServiceBehavior(......)]
public class SomethingConcrete : IMyInterface
{
    // implementation of SomeMethod
}
answered 2010-06-23T09:33:39.177

Your Answer