Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing authority of Optional/Required Addons #607

Merged
merged 3 commits into from
Mar 18, 2016
Merged

Conversation

mxgrey
Copy link
Member

@mxgrey mxgrey commented Feb 10, 2016

In the current implementation of "optionality" for Addons, it is an Addon that decides for itself whether it is optional for a given Manager type. This is semantically backwards, since the Manager owns the Addon and should therefore have authority over whether the Addon is considered optional or required.

This pull request reverses this relationship. Now a Manager can specify which Addons are required for it in a similar fashion to how Addons can be specialized for it. In fact, declaring an Addon as "required" will also automatically specialize the Addon for that Manager.

@mxgrey
Copy link
Member Author

mxgrey commented Feb 10, 2016

I'm kind of wondering if we should change the name of the class SpecializedAddonManager<~> to SpecializedForAddon<~>. That would be more consistent with the class named RequiresAddon<~>. Same thing for SpecializedNodeManager.

@jslee02 jslee02 added this to the DART 6.0.0 milestone Feb 12, 2016
@jslee02
Copy link
Member

jslee02 commented Mar 15, 2016

The overall looks good.

I have similar concern about the names though. The class name RequiresAddon sounds intuitive to use, but I'm not sure if having verb in class name (e.g., RequiresAddon) is a good practice. At the same time, I can't come up with better alternative for now. So I would go with RequiresAddon unless someone has alternative name for it.

Also, if we don't have any alternative then changing SpecializedAddonManager to SpecializedForAddon seems good for the consistency.

@jslee02 jslee02 mentioned this pull request Mar 15, 2016
@mxgrey
Copy link
Member Author

mxgrey commented Mar 15, 2016

I think a verb makes sense in a class name if the class itself does not stand alone. If its purpose is to augment a more complete type, then a verb name would be good for expressing this role (IMO).

We would never have an object that is simply a RequiresAddon<T>. Instead, we would always place RequiresAddon<T> in an inheritance list where it could be thought of as expressing a characteristic of the class (the characteristic that the class requires an Addon of type T).

@mkoval
Copy link
Collaborator

mkoval commented Mar 16, 2016

I generally agree with @jslee02's argument that class names should be nouns. However, in this case, I agree with @mxgrey. Changing RequiresAddon<T> to RequiredAddon<T> makes it sound like the subclass is a T addon, not that it contains a required T addon.

I think we should stick with the verb names. Like @jslee02 suggested, we should also change SpecializedAddonManager<T> to SpecializedForAddon<T> for consistency.

@jslee02
Copy link
Member

jslee02 commented Mar 17, 2016

Okay, RequiresAddon<T> sounds good then.

@mxgrey Can you change SpecializedAddonManager<T> to SpecializedForAddon<T> if you are also fine with it?

@mxgrey
Copy link
Member Author

mxgrey commented Mar 17, 2016

The renaming has now been pushed.

@jslee02
Copy link
Member

jslee02 commented Mar 17, 2016

Thanks! Will merge once Travis-CI tests are passed.

@psigen
Copy link
Collaborator

psigen commented Mar 17, 2016

Just chiming in here: I believe it's pretty common for mixins to have verb/adjective naming, since they are often being used to describe properties that an existing class is taking on as a result of the inheritance rather than defining a class itself. This naming makes sense under that convention.

jslee02 added a commit that referenced this pull request Mar 18, 2016
Changing authority of Optional/Required Addons
@jslee02 jslee02 merged commit 530c2e4 into master Mar 18, 2016
@mxgrey mxgrey deleted the grey/optional branch April 18, 2016 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants