Les interfaces sont-elles un fléau ou sont-elles mal utilisées ?

There are several considerations and practices concerning interfaces

Some developers say that interfaces can be used as a replacement of multiple inheritance mechanisms, which cause complexity and ambiguity. But each feature must be implemented each time it is declared: this is not an inheritance, this is a wrapper to the description of a part of a group of classes, like IDisposable. It is the same as a multiple inheritance with one implemented class and some abstract classes: it is a particular case which allows only one way hierarchy with interfaces as abstract connectors that describes services.

Some developers say that interfaces can be used to separate the access to an object of this instance. Historically, interfaces are a COM & DCOM heritage: they are used to manipulate components services, whatever objects are, where they are, and how they are implemented. Interfaces are not a replacement to multiple inheritance, they are something else.

Recommended articles:
A plea for full multiple inheritance support in .NET
A Typed Intermediate Language for Compiling Multiple Inheritance

Interfaces can be used to solve some design issues in .NET

In component communication, because they are like a transfer of addresses: “An interface describes a group of related functionalities that can belong to any class or structure. Interfaces can consist of methods, properties, events, indexers, or any combination of those four member types. An interface cannot contain fields. Interfaces members are automatically public” (MSDN Documentation). To simplify, in distributed computing, a client has an “instance” of an interface to an object that is on the server.

In the conceptualization of services provided by classes instead of multiple inheritance: this abstraction layer should be separated from the classes layer. It is not an implementation because it is a high-level design view and this should not be coded: a method should not be implemented several times in the same way, which is facilitated by the genericity. An interface corresponds to a fully implemented class, to a class that contains abstract members, or to a fully/pure abstract class.

To provide a kind of low level polymorphism for generic classes to manipulate all possible linked templates while this feature doesn’t exist in C#: an undetermined type like GenericClass < > can’t be used without providing a specific type unless reflexion is used.

But they create some problems

All functionalities must be implemented each time.
The type dependence is fragmented to the detriment of quality.
The code complexity is increased: lots of declarations and big code for one class instead of lots of small classes with small code.

Using interfaces in implementation increases the abstraction of an abstraction, reduces the code factorization, reduces the maintainability and increases the risks of a project.

Multiple inheritance may be used to solve some design problems in .NET

To inherit from multiple classes and to implement only once a service provided by several classes.
To have a strongly typed design without seeing double or going crazy.
To provide a high level of polymorphism.

But it creates some problems

All functionalities must be implemented rigorously.
It requires a study and an understanding of the object programming theory.
The code complexity is increased: lots of small classes with small code instead of lots of declarations and big code for one class.

Using multiple inheritance increases the simplicity of the abstraction (of interfaces, if models are based on), reduces the code size, reduces the confusion about models and increases the safeness of a project.

Interfaces don’t compensate for the lack in multiple inheritance as well as in generic polymorphism

Both have their difficulties, their advantages and their applications : discuss the pros and cons of interfaces is a wrong debate without end.

Code based on interfaces is a default programming and an entangled path based on a difficult simplification of what objects and components are. Interfaces are a full or a partial copy of a class description: they don’t provide better software experience but better ways to design. The mechanisms of interfacing in distributed environment should be provided by the CLR and based on classes descriptions which are the interfaces : the virtual tables.

Of course, do not use interface and multiple inheritance reduces the code complexity, and a developer should have the choice depending of the work.

Consider this code:

The equivalent of these 45 lines in multiple inheritance is simpler and more intuitive. It takes 30 lines: the method is implemented only once, there is no interface because classes structure are the interface, and code is better:

Supporting generic polymorphism and multiple inheritance in .NET and C# could allow making programs more stable and efficient, as well as coding like this :

It is impossible to write the last line and the problem is solved by using interfaces:

But it is less elegant.