locked
Coupling and Decoupling of Service Contract and Service Type RRS feed

  • Question

  • User686339638 posted

    Are there two or more ways to couple and decouple the service type and service contract? 

    The book I'm reading speaks of coupling and decoupling in two different ways. Am I reading it wrong? I can provide examples but I'm trying not to over complicate this post.

    1) She speaks of coupling and decoupling the service contract and service type. Basically coupled is when you don't define an interface for the service contract. You just use the type. Decoupling is when you use an interface as the contract and a type to implement the interface.

    2) But she also seems to talk about coupling the service contract (interface) and service type (class implementation) by placing them both in the same assembly. I understand assembly to mean class file (.cs).

    ARe both of these coupling/decoupling scenarios? How do you differentiate between the types in conversation? Do they have different names?

    I can copy the actual text if necessary. But i was hoping you might understand without all the extra reading.


    Thanks!

    Friday, September 20, 2013 5:04 PM

Answers

  • User2019981500 posted

    Hi

    What i believe is that it is just one concept and secondry is that it is often a good practice to let your code files contain only a single class, or a single interface. But these coding practices are a meansultimately.To better structure your code making it easier to work with. If You are comfort to work with if the classes are kept together with their interfaces, by all means do so.Again ,For me I prefer to have the interface and class in the same file when there is just one class that implements the interface,

    regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 21, 2013 1:33 AM