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 implementation smells #1982

Conversation

nikitadavies
Copy link

No description provided.

@manticore-projects
Copy link
Contributor

Greetings!

Thanks for your effort and interest in JSQLParser.
Unfortunately I am not a big fan of this change because it makes it harder to understand the composition of the SQL since I have to jump now in between various methods.

In my understanding building SQL code is one reasonable exception from various Java Code quality measurement because in this case long spaghetti code with lots of if/else conditions are actually better to read.

Although I will leave this open a bit for collecting opinions on this.

@nikitadavies
Copy link
Author

nikitadavies commented Mar 30, 2024 via email

@manticore-projects
Copy link
Contributor

Instead, I would humbly request you to have a look at this particular commit: ce72d72. I have introduced an explaining variable to the method hashCode() making it more readable and understandable. Please let me know your view on the same.

Apologies for being blunt: I do not see any point in this since the hash function is a kind of internal API and not used by anyone. You change is not useful or more readable but just takes more lines of code. Every IDE will generate the existing hash code for a good reason. I would be most suspicious when this presentation suddenly changed for no obvious reason.

I'm open to further discussions and ideas on how we can strike a balance between readability and maintainability.

We are riding the wrong horse here. If you really care about readability and maintainability then look at the various DDL statements like CREATE and ALTER. Those are really a big mess and any change will be welcome because it can get only better.

@@ -366,14 +366,25 @@ public void visit(OverlapsCondition overlapsCondition) {
overlapsCondition.getRight().accept(this);
}

@Override
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not going to accept any of those changes because they don't improve readability of the code.

@nikitadavies
Copy link
Author

Instead, I would humbly request you to have a look at this particular commit: ce72d72. I have introduced an explaining variable to the method hashCode() making it more readable and understandable. Please let me know your view on the same.

Apologies for being blunt: I do not see any point in this since the hash function is a kind of internal API and not used by anyone. You change is not useful or more readable but just takes more lines of code. Every IDE will generate the existing hash code for a good reason. I would be most suspicious when this presentation suddenly changed for no obvious reason.

I'm open to further discussions and ideas on how we can strike a balance between readability and maintainability.

We are riding the wrong horse here. If you really care about readability and maintainability then look at the various DDL statements like CREATE and ALTER. Those are really a big mess and any change will be welcome because it can get only better.

I'm working on refactoring CREATE and ALTER as well.

@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