Refactor Locatable into an interface, HasLocation #4118
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since the
mixinwas 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,Locatablewas 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 onWarnableobjects (which implementedLocatable). So we can move the getter toWarnable.Then we can change every case of
with Locatabletoimplements Locatable. Except that the interface isn't even needed on some classes, likeCategoryandPackage, 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.