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

Remove empty interfaces State and Action #3

Merged
merged 2 commits into from Mar 14, 2016

Conversation

clemp6r
Copy link
Contributor

@clemp6r clemp6r commented Mar 14, 2016

Hi again,

I removed the State and Action interfaces, they're useless until they remains empty. Generics are enough to get type safety. Also, users may not understand why they would have to implement empty interfaces.

What do you think?

@brianegan
Copy link
Owner

Hey, thanks so much for the cool PRs! Really digging the outside ideas and help :)

This is an interesting proposition, but I'm leaning towards keeping the Marker interfaces.

Say, for example, you want to find all possible actions in your project? Which is not uncommon if you're new to a project. You could look up anything that implements the Action interface! Yay!

Or, similarly, you're reading through some code in a big project and find an "Init" class, but you'd have no indication it's an action until you look through the code to see how it's used. In these cases, a simple marker interface can help convey the intention of the author to the reader, without this library dictating any specifics as to how they work.

So, for me, the idea behind the marker interfaces is to convey to the reader of the code the intention behind the author's work. Does this add up from your point of view, or do you simply find them confusing? Do you think others would find implementing such Marker interfaces confusing? I'm still fairly new to the Java / Kotlin world, so advice would be great :)

Thanks again!

@clemp6r
Copy link
Contributor Author

clemp6r commented Mar 14, 2016

I understand but I still think it will be confusing for future users, because In Java it is not common to declare empty interfaces. Interfaces are use to define a contract, like methods that are required to exists. If you don't put anything in the Interface, it is probably useless.

Also, the two generic types in the Store interface will force users to declare their own supertypes, so as you wanted they will still be able to easily find all actions (unless they use Any as their action type but it will be their responsibility).

@brianegan
Copy link
Owner

Cool, I dig it! Checked with some coworkers as well to get some general opinions. Y'all have convinced me :)

Thanks again so much for contributing! Really appreciate it :)

brianegan added a commit that referenced this pull request Mar 14, 2016
Remove empty interfaces State and Action
@brianegan brianegan merged commit 4141a92 into brianegan:master Mar 14, 2016
brianegan pushed a commit that referenced this pull request Mar 23, 2016
Moved the addSingleton into a StoreModule. This did not work :(
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.

None yet

2 participants