I assume this is largely language-agnostic, but I'm working in C# if it's not
Let's say interface I3
inherits from I2
, which in turn inherits from I1
. I could write this:
interface I1 { ... }
interface I2 : I1 { ... }
interface I3 : I2 { ... }
Or alternatively this:
interface I1 { ... }
interface I2 : I1 { ... }
interface I3 : I1, I2 { ... }
The I1
in interface I3
is redundant - anything that implements I3
will still require anything declared in I2
, which includes anything in I1
.
To my mind the latter is more readable - I can see at a glance all the 'base' interfaces without having to dig down the inheritance tree - but I'm not sure if it's considered good practice. Is it? Are there any hidden traps here?