dashjoin / platform

Dashjoin Is an Open Source & Cloud Native Low Code Development and Integration Platform that helps teams deliver applications faster 🚀 Uses a data-driven approach inspired by Linked Data to make use of your existing assets
https://dashjoin.com
GNU Affero General Public License v3.0
89 stars 7 forks source link

RenameSuggestion #298

Open AnonymousAccount4SE opened 11 months ago

AnonymousAccount4SE commented 11 months ago

Renaming Suggestion of Method Names to Make Them More Descriptive


Description

We have developed a tool (NameSpotter) for identifying non-descriptive method names, and using this tool we find several non-descriptive method names in your repository:

/* Non-descriptive Method Name in dashjoin-core/src/main/java/org/dashjoin/function/ERDiagram.java */
  String s(String s) {
    if (s == null)
      return "";
    else
      return s;
  }

We considered "s" as non-descriptive because it only contains one letter. We proposed renaming the method name to "getStringSafely". Consequently, when we look at this method name, we will be informed that this method is designed to get string safely without causing NullPointerException.

  String q(String s) {
    if (s == null)
      return null;
    if (StringUtils.isAlphanumeric(s.replace('_', 'a')))
      return s;
    else
      return '"' + s + '"';
  }

We considered "q" as non-descriptive because it also only contains one letter. We proposed renaming the method name to "isAlphanumeric", which reminds developers that this method implements functions related to an API method (StringUtils.isAlphanumeric).

  String t(String s) {
    if (s == null)
      return null;
    return s.replaceAll(" ", "_");
  }

We considered "t" as non-descriptive because it also only contains one letter. We proposed renaming the method name to "replaceSpaceWithUnderScore", which explicitly delivers the main function of this method.

Do you agree with the judgment?