I have three classes in an inheritance chain:
AddActorUITests : WebTestBase : IntegrationTestBase
However I would somehow like to signal by naming convention that WebTestBase
inherits from IntegrationTestBase
so that the developer writing code in AddActorUITests
does not have to check WebTestBase
to verify that it inherits from IntegrationTestBase
.
Any suggestions?
Inheritance is about is-a
relationship between the classes. Inheritance should be easy to tell without having to use some kind of convention in the naming.
For instance if you have a Dog
which inherits Animal
you don't name it DogAnimal
. It's already easy to understand what a dog is. Let's look at it from the other perspective. When you code against the Dog
class, why is it so important to know that it's an Animal
that you need to indicate it in the name? Hungarian notation was abandoned for a reason.
If you still need that notation, aren't you more using inheritance as a toolbox. i.e. you do inheritance just to get some nice features into the sub classes? In that case it's much better that you use composition.
If you're using Visual Studio
you can use comments?
/// <summary>
/// Inherit <see cref="IntegrationTestBase"> class
/// </summary>
class WebTestBase : IntegrationTestBase
{
...
}
and when the user types out the WebTestBase
, Visual Studio
will automatic show the comments in a popout message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With