Code review comment for lp:~alan-griffiths/mir/even-NullWindowManager-configures-surface

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Come to think of it, establishing new precedent is important. Because people
> often refer to precedent and consistency in their reasoning. Even as a reason
> to reject more simplistic and maintainable designs.

I agree that precedents are important. However, "new precedents" should be avoided when they break consistency and introduce simplistic designs.

> So we need to break the
> mold ASAP.

I do not see any need (and certainly not an urgent one) to break from the well established industry practice of having pure virtual interfaces. (This has been widely followed for at least 20 years. See, for example, Barton & Nackman from 1994.)

> In cases like this where a class used in production is kind of like Null, kind
> of like Stub, and very much useful in its bare form, I think this is where
> those prefixes (including Skeleton) should not be used. So rename
> SkeletonWindowManager -> WindowManager and remove the existing pure virtual
> one.

I can remember when I was naive enough to "know better" and entertained thought like this, but experience has taught me that what appear at first to be exceptions are often not as the system evolves over time.

> This not only results in less typing, but fewer classes and less maintenance.
> As "Null" and "Stub" forms need never exist (they do implicitly). You can
> still add a Mock form later if required.

Much more important than reducing typing is reducing reading. Avoiding the need to go look at the implementation of what looks like an interface to discover whether it actually has an implementation is going to save far more time over the life of a project than saving eight keystrokes.

Introducing a precedent like the one you propose will add that cost to every interface in the system - as the reader will never be certain which classes are exceptions to the general rule.

« Back to merge proposal