Adding interfaces that won't be actually used

Posted by devoured elysium on Stack Overflow See other posts from Stack Overflow or by devoured elysium
Published on 2010-05-20T13:22:07Z Indexed on 2010/05/20 13:30 UTC
Read the original article Hit count: 136

Filed under:
|
|

I currently have two interfaces(that I'll name here IA and IB):

interface IA {
    int Width;
    int Height;
    ...
}

interface IB {
    int Width;
    int Height;
    ...
}

that share the same two properties: they both have a Width and a Height property.

I was thinking if there is any point in defining an IMatrix interface containing a Width and Height properties:

interface IMatrix {
    int Width;
    int Height;
}

The thing is that although they share both the same properties, I won't make use of polymorphism with IMatrix in any of my coding: i.e., there won't by any situation where I'll want to use an IMatrix, I'll just want to use IA and IB. Adding an IMatrix seems more like over-engineering than other thing, but I'd like to ask you guys what your opinion is on the matter.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about java