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

BATCH-2715: Change the method name "getStartable" to "isStartable". #600

Closed
wants to merge 1 commit into from

Conversation

Kui-Liu
Copy link
Contributor

@Kui-Liu Kui-Liu commented Apr 22, 2018

The method is named as "getStartable". "getStartable" is prone to obtain something. "isStartable" is a query asking whether the stepExecution is startable, which describes what the method is doning. So, "isStartable" should be more intuitive.

@Kui-Liu Kui-Liu changed the title Change the method name "getStartable" to "isStartable". BATCH-2715: Change the method name "getStartable" to "isStartable". Apr 24, 2018
@fmbenhassine
Copy link
Contributor

Hi,

I agree with you on the change. However, since the method getStartable is protected, changing its name in one shot might break clients extending the class.

We need to proceed in two steps: deprecate it in one version and remove it in the next version. For example:

  1. create a new method isStartable (with the same signature which calls getStartable) and deprecate the getStartable method in version 4.1
  2. remove the getStartable method in version 4.2

Can you please update the PR with step 1? We will then do the necessary for v4.2.

Thanks in advance,
Mahmoud

@Kui-Liu
Copy link
Contributor Author

Kui-Liu commented Aug 13, 2018

@benas Hi, how about now?

@@ -238,6 +238,26 @@ public String getStepName() {
return result;
}

protected boolean isStartable(StepExecution stepExecution, ExecutionContext context) throws JobExecutionException {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can avoid code duplication by making isStartable call getStartable:

protected boolean isStartable(StepExecution stepExecution, ExecutionContext context) throws JobExecutionException {
   return getStartable(stepExecution, context);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@benas Updated the PR with your comments.


}

@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to document this deprecated method and say which method is intended to replace it (isStartable in this case).

The method is named as "getStartable". "getStartable" is prone to obtain something. "isStartable" is a query asking whether the stepExecution is startable, which describes what the method is doning. So, "isStartable" should be more intuitive.
@fmbenhassine
Copy link
Contributor

@brucekuiliu Thank you for updating the PR! LGTM. Rebased and merged as e29f77e.

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