Interface-Based Programming
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:Articles |
| .NET Articles |
|
Interface-Based Programming |
| © 2005 O'Reilly Media, Inc. |
| This article—Interface-Based Programming—is from Programming .NET Components, by Juval Lowy. Copyright © 2005 O'Reilly Media, Inc. All rights reserved. Reproduced by permission. This article has been edited especially for C# Online.NET. Read the book review! |
|
Interface-Based Programming
As explained in Chapter 1, separation of interface from implementation is a core principle of component-oriented programming. When you separate interface from implementation, the client is coded against an abstraction of a service (the interface), not a particular implementation of it (the object). As a result, changing an implementation detail on the server side (or even switching to a different service provider altogether) doesn’t affect the client. This chapter starts by presenting .NET interfaces and describing what options are available to .NET developers when it comes to enforcing the separation of interface from implementation. It then addresses a set of practical issues involving the definition and use of interfaces, such as how to implement multiple interfaces and how to combine interfaces and class hierarchies. After a detailed look at generic interfaces, the chapter ends with a discussion of interface design and factoring guidelines.
|
See also
- Implementing Interfaces
- Interface-Based Programming
- Should I use an abstract class or an interface?
- Test for an interface implementation
- Using Inheritance Effectively
- Visual Studio: Implementing interfaces


