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

Inconsistent key names in COPY / RENAME / RENAMEX / PUBLISH command documentation and other fixes. #2196

Open
wants to merge 3 commits into
base: 2.7.x
Choose a base branch
from

Conversation

toddmerrill
Copy link
Contributor

@toddmerrill toddmerrill commented Nov 8, 2021

I tried to be conservative with the parameter name changes, only changing methods with the same function signature as in the Redis docs. I couldn't bring myself to change param 'dbIndex' to 'db' in RedisOperations.move(). I think our name is more descriptive.
The other changes are javadoc inconsistencies I found when reading through. Let me know if you need anything changed.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 8, 2021
@mp911de mp911de self-assigned this Mar 6, 2023
Copy link
Contributor

@jxblum jxblum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All and all, I am fine with most of these changes. In general, I prefer self-describing code and effective Javadoc. Our Javadoc is in much need of improvement, as is apparent, even in the small collection of refactorings here.

If users have to guess or lookup what something means, then this is a failure of the framework since its causes a context switch in the users workflow and disrupts their productivity.

By way of example, if an @param tag reads:

@param key {@link String key} identifying and referring to the data structure or value in Redis, such as a String, Integer, dates, arrays or hashes; must not be {@literal null}`

Vs.

@param key must not be {@literal null}.

Then as user, I don't have to wonder what a Redis "key" is? I might still need to lookup the fact that Redis is a dictionary mapping keys to different types of values, but that is a different issue. This might sound trivial, but can be easily taken for granted.

Of course, one could argue that this will happen to new Redis users regardless, but minimizing this effect will go along way in increasing adoption of our frameworks due to ease of use and intuitiveness.

Comment on lines +165 to +166
* @param source must not be {@literal null}.
* @param destination must not be {@literal null}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, neither source nor destination describe what they are. For instance, are they keys, are they values, what?

"must not be {@literal null}" is not informative and arguably no longer needed given the package-level @NonNullApi requires non-null values when method parameters are not explicitly annotated with @Nullable.

I am fine with shorter names as long as the Javadoc makes it apparent what things are and what they are used for.

* @param newKey must not be {@literal null}.
* @return {@literal null} when used in pipeline / transaction.
* @see <a href="https://redis.io/commands/renamenx">Redis Documentation: RENAMENX</a>
*/
@Nullable
Boolean renameIfAbsent(K oldKey, K newKey);
Boolean renameIfAbsent(K key, K newKey);
Copy link
Contributor

@jxblum jxblum Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the renames are fine here.

But, I think the Javadoc needs serious work. For example, what does the oldKey/key refer to? Is a key to a data structure in Redis? Is it a key in a hash data structure mapping. I know I was confused by this when I first started learning about Redis.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not our responsibility to educate folks about the concepts of their data store.

@jxblum jxblum added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants