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

[java] Actions javadoc: #perform vs #build #8412

Merged
merged 1 commit into from Jun 22, 2020

Conversation

alb-i986
Copy link
Contributor

Description

Slightly improving the documentation.
Pointing out that it’s #perform what the user needs to call at the end of the method chain to actually perform the actions.

Motivation and Context

It would be natural for one who is familiar with the Builder pattern, and it's the first time that he/she uses the Actions class (exploring the API with method completion), to come up with something like this:

new Actions(driver)
  .this()
  .that()
  [..]
  .build();

And expect that it will work.

Then, when they run their test and find that something didn't work, it's not going to be easy to figure out what went wrong. More specifically, to trace it back to the call to build().

This PR is trying to solve that by adding a warning in the javadoc.

Although I would prefer the build() method to behave as perform() (and deprecate perform() afterwards).

This comes from a personal experience, where I tried to use the Actions class after some time (a few years) I hadn't used it and I forgot that you need to call perform() and not build().

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Javadoc improvement

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Slightly improving the documentation.
Pointing out that it’s #perform what the user needs to call
at the end of the method chain to actually perform the actions.
Copy link
Member

@shs96c shs96c left a comment

Choose a reason for hiding this comment

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

Fair point, well made. :)

@shs96c shs96c merged commit fab2f11 into SeleniumHQ:master Jun 22, 2020
@shs96c
Copy link
Member

shs96c commented Jun 22, 2020

Thank you for clarifying things. It's appreciated!

titusfortner pushed a commit to titusfortner/selenium that referenced this pull request Aug 13, 2020
Slightly improving the documentation.
Pointing out that it’s #perform what the user needs to call
at the end of the method chain to actually perform the actions.
@alb-i986 alb-i986 deleted the actions-build-vs-perform-javadoc branch April 3, 2021 22:20
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