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

Refactor design smells #1986

Closed

Conversation

nikitadavies
Copy link

No description provided.

@manticore-projects
Copy link
Contributor

Please why exactly are we doing this? What would we achieve from changing this particular code?

@nikitadavies
Copy link
Author

Please why exactly are we doing this? What would we achieve from changing this particular code?

Thanks for your review & feedback.

By incorporating enum classes which have the following advantages.

Enums are strongly typed, which means that the compiler will catch any errors at compile time rather than at runtime. This makes code more reliable and easier to debug. The other 2 benefits of using enum class is that 1) Enums can be extended to add new values. This makes our code more flexible and adaptable to changing requirements.2) Enums provide a more readable way to define a fixed set of values. This makes the code easier to understand and maintain.

for the second case , I'm trying to incorporate pull up method refactoring to get rid of duplicate code , as it’s better to do some changes in a single place than have to search for all duplicates of the method in subclasses

so overall objective in doing this changes are refactoring code as per the standard refactoring mechanism.

In addition, as previously indicated in your remarks, I'm trying to address a few problems with ALTER functionalities.

Copy link
Contributor

@manticore-projects manticore-projects left a comment

Choose a reason for hiding this comment

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

I approve the refactoring of the String List Utils. This is actually very good and welcome.
I will not accept this Enums and the specific Keyword related stuff.

Please don't combine different issues and changes within on PR. PRs should be as distinct and encapsulated as possible please. For this one, focus on the String List Utils only. Once, this gets merged we can discuss other stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually a good change, but please move those List Utils into a neutral Class which is not named anything like SELECT since Lists can be used anywhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely a No. You just scatter the code around without any benefit.

@@ -41,83 +42,7 @@ public static String orderByToString(List<OrderByElement> orderByElements) {

public static String orderByToString(boolean oracleSiblings,
List<OrderByElement> orderByElements) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good one!

@@ -25,9 +25,5 @@ public MultiAndExpression(List<Expression> childlist) {
super(childlist);
}

@Override
Copy link
Contributor

Choose a reason for hiding this comment

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

No.

@@ -25,9 +25,5 @@ public MultiAndExpression(List<Expression> childlist) {
super(childlist);
}

@Override
public String getStringExpression() {
Copy link
Contributor

Choose a reason for hiding this comment

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

No.

@@ -19,9 +19,4 @@ public MultiOrExpression(List<Expression> childlist) {
super(childlist);
}

@Override
Copy link
Contributor

Choose a reason for hiding this comment

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

No.

@@ -78,4 +76,14 @@ public String toString() {
return sb.toString();
}

public String getStringExpression(){
Copy link
Contributor

Choose a reason for hiding this comment

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

No.

@nikitadavies
Copy link
Author

I approve the refactoring of the String List Utils. This is actually very good and welcome. I will not accept this Enums and the specific Keyword related stuff.

Please don't combine different issues and changes within on PR. PRs should be as distinct and encapsulated as possible please. For this one, focus on the String List Utils only. Once, this gets merged we can discuss other stuff.

Sure, I will create a separate PR for the String List Utils

@manticore-projects
Copy link
Contributor

Closing as stale, please resubmit when work will have been finished.

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