Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Implementing an interface says HEY! LOOK AT ME! I CAN DO THIS. </p> <p>Interfaces lend themselves toward many applications:</p> <ul> <li><strong>Unit testing:</strong> If your methods accept interfaces as parameters, you can pass mock objects to test for bugs ensuring that any bugs found are not caused by bugs in the parameters.</li> <li><strong>Code Reuse:</strong> You can make your code more generic if it uses interfaces, and more generic code lends itself to reuse. For example, UI Controls are highly reusable components which make use of interfaces such as INotifyPropertyChanged, which when implemented makes your custom classes work well with databinding.</li> <li><strong>Software engineering best practice:</strong> It's good to separate the specification from the implementation because smarter, more experienced people said so. There are also plenty of good design patterns which require the use of interfaces.</li> <li><strong>Mixins:</strong> Combined with extension methods you can use interfaces to implement quasi-mixins. When you implement that interface on a class, the class will inherit the relevant functionality. The best example I can think of here are the LINQ extension methods, which appply to classes which implement IEnumerable. Interfaces by themselves do not give us multiple inheritance, but mixins do.</li> <li><strong>Crossing system boundaries:</strong> It's often nice to create interfaces for objects that you expect to cross system boundaries (i.e. web services). This can simplify serialisation and allows you to modify the concrete class without affecting the interface between two systems.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload