Rename method Subscriptions.create for semantic clarity.
See original GitHub issueThe Subscriptions.create
method is extremely useful but poorly named. Is there a reason that it does not have a more semantic name which emphasizes the nature of the action being for unsubscribe rather than on subscribe?
When you read code like this:
subscription.add(Subscriptions.create(() -> runnable.run()));
it is not at all apparent that this code is for unsubscription.
Something along the lines of unsubscribeAction
, withUnsubscribeAction
, or doOnUnsubscribe
would add a ton of clarity to the readability of this code.
subscription.add(Subscriptions.unsubscribeAction(() -> runnable.run()));
subscription.add(Subscriptions.withUnsubscribeAction(() -> runnable.run()));
subscription.add(Subscriptions.doOnUnsubscribe(() -> runnable.run()));
Now I realize we can’t just rename this method, so I am proposing it as an addition along with deprecation of the original.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
coding style - Naming: Should you sacrifice briefness for clarity?
If brevity can be sacrificed for clarity, it should. But if verbosity can be sacrificed for clarity, even better.
Read more >Semantics in a Nutshell. It's a lack of clarity that creates… |
To summarise, semantics is about meaning. Good semantics equals clarity. And there are good reasons you should invest in it.
Read more >A Semantic-Enabled Platform for Realizing an Interoperable ...
It leverages semantic web technologies to address the two key challenges in expanding the IoT beyond product silos into web-scale open ecosystems: data ......
Read more >web3-core-subscriptions | Yarn - Package Manager
This subscriptions package is used within some web3.js packages. ... format is based on Keep a Changelog, and this project adheres to Semantic...
Read more >Compose Foundation - Android Developers
RememberObserver is a replacement for CompositionLifecycleObserver with modified semantics and renamed methods. Changing to the new API can be done mechanically ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That changes nothing about the naming of the method and that it’s a poor choice.
On Wed, Jun 1, 2016, 10:15 PM Artem Zinnatullin notifications@github.com wrote:
I’m closing this issue due to inactivity. If you have further input on the issue, don’t hesitate to reopen this issue or post a new one. Better yet, you can propose a PR for 2.x about the name change if you wish.