You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor Locatable into an interface, HasLocation (#4118)
Since the `mixin` was introduced, and the class modifiers, we've had
some tech debt around our mixins. We have a lot of mixins, and some of
them are better suited as interfaces or base classes. In this case,
`Locatable` was a mixin with mostly abstract getters, and one
implemented getter. To me this really smelled like it should be an
interface.
Turns out, that implemented getter, `documentationIsLocal`, is only
called on `Warnable` objects (which implemented `Locatable`). So we can
move the getter to `Warnable`.
Then we can change every case of `with Locatable` to `implements
Locatable`. _Except_ that the interface isn't even needed on some
classes, like `Category` and `Package`, so we can just remove the mixin
there.
Then a rename. I think it's idiomatic for mixin names to end in "able"
like "Locatable," "Warnable," "Namable" to suggest the ability that is
mixed in. And it is more idiomatic for an interface to start with "Has"
to suggest features that are implemented by an implementing class. But
there's nothing hard-and-fast here; I'm open to other naming ideas.
0 commit comments