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

Discussion: rename and deprecated status of putDirect and deleteDirect #11

Open
erickok opened this issue Dec 12, 2016 · 2 comments
Open

Comments

@erickok
Copy link
Owner

erickok commented Dec 12, 2016

As per Binghammers question and subsequent discussion, let us discuss the best solution for 2.x.

In RxCupboard 1.x there were originally 2 methods to add: put(T entity) and delete(T entity). These directly called into Cupboard to perform the operation. Rightfully so, I then got a PR to add reactive versions for these, to use in streams. We are a reactive library after all!

So we introduced putRx(T entity) and deleteRx(T entity). They had to be called xxxRx as we already had methods with the same name and parameter signature with the direct variants.

For 2.x I decided that the reactive versions of these methods were actually the ones that we should have been using all along. We are reactive. So I promoted them to be the primary way of adding/deleting entities by renaming them to simple put and delete. The direct, non-reactive variants had to be renamed then to putDirect and deleteDirect.

For the 2.0-rc1 I was in doubt whether the xxxDirect methods should stay at all. Therefore they are marked as deprecated. I am not sure though, they are convenient and maybe we should keep them. In we keep them, I will un-deprecate them. Regardless I will have to add JavaDoc to the available methods.

@Binghammer
Copy link

Like you said; "We are Reactive". I think the direct methods should be removed. In the case you need to do something direct, you should still do it in a reactive way:

Single.just(item).flatMap(rxDatabase::put).subscribe();

or

rxDatabase.put(clock).subscribe();

This way, consistency is encouraged.

@erickok
Copy link
Owner Author

erickok commented Dec 14, 2016

Sure, that was the idea. There's some value in ease of use though of the direct variants. I'd love more input from RxCupboard users. At least I'm happy that my idea to promote the reactive variants isn't mal conceived.

@erickok erickok closed this as completed Dec 14, 2016
@erickok erickok reopened this Dec 14, 2016
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

No branches or pull requests

2 participants