foreword:
I have a component, lets call it IView. This component is implemented by BaseView class which holds most of it’s functionality. We are using the template pattern to delegate logic to inheretting classes.
The problem:
We have a property named IView.Visible, that indicates if the component should or should not be visible. This property is not virtual since it involves some logic in our BaseView.
We have created a virtual protected method IsVisible which is invoked from BaseView.Visible to decide the final value of IView.Visible.
We feel that this property name, IsVisible, is not descriptive and clear enough to the implementor of the derived class.
It’s been suggested to rename it to ShouldBeVisible, but we still fill that there is a better name.
What do you think ? Do you have a better name ? Is there a good naming convention that covers this topic of template methods ?
Update: Just to clarify a point, the Visible and IsVisible properties don’t have side effect on the component, The Visible property uses the value from IsVisible to decide if the value of Visible should be true, but it is not the only consideration and couple other of the internal states of the component to give the final verdict.
I’ve never been especially keen on this naming convention, but the Framework Design Guidelines book suggests the usage of ‘Core’ as the suffix for this type of pattern. This code is taken from the Microsoft System.Windows.Forms.Control class
My concern with this solution is that you are exposing a method of unknown complexity with possible side effects as a property, but since you can rummage through the .NET framework code and see that this convention is used quite often if you are looking for a standard this may be as close as you’ll get.