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

Removal of Triple, and Quadruple #3529

Merged
merged 10 commits into from
Dec 5, 2024
Merged

Removal of Triple, and Quadruple #3529

merged 10 commits into from
Dec 5, 2024

Conversation

wadoon
Copy link
Member

@wadoon wadoon commented Nov 23, 2024

Refactoring

This PR starts the removal of generic data classes in favor of Java records (aka. named tuples). In this PR, only Triple and Quadruple are removed.

In general, generic parametric data classes (Tuple, Union, ...) lead to unreadable, incomprehensible code, e.g., what does the entity Triple<StatementBlock, URI, Integer> express? Answer: It is the key in a map to find block contracts. Using the record BlockContractKey expresses this better than triple of something.

Therefore, records give you the chance of defining useful variable names, and documentation, and also avoid auto-boxing (hence NPE).

Intended Change

No use of Triple<…> and Quadruple<…>.

Type of pull request

  • X Refactoring (behaviour should not change or only minimally change)
  • X There are changes to the (Java) code

Ensuring quality

  • X by TEST CASES!!! and compiler

@wadoon wadoon changed the title Weigl/recordsftw Removal of Triple, and Quadruple Nov 27, 2024
Copy link
Member

@WolframPfeifer WolframPfeifer left a comment

Choose a reason for hiding this comment

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

Thanks! In my opinion, it is a very good idea to remove these two classes, and use records with good names instead.

I only have some minor remarks:

  • In some comments, "first" and "second" have been replaced too aggressively ...
  • Some uses of var should be removed in my opinion.
  • Some record parameters could use better names instead of "first", "second", ...

@wadoon wadoon requested a review from WolframPfeifer December 3, 2024 22:53
Copy link
Member

@WolframPfeifer WolframPfeifer left a comment

Choose a reason for hiding this comment

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

Thanks! Apart from the spotless formatting, I think it is fine now.

@wadoon wadoon enabled auto-merge December 5, 2024 17:27
Copy link

sonarqubecloud bot commented Dec 5, 2024

@wadoon wadoon added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 5, 2024
@wadoon wadoon added this pull request to the merge queue Dec 5, 2024
Merged via the queue into main with commit 0ae2058 Dec 5, 2024
10 checks passed
@wadoon wadoon deleted the weigl/recordsftw branch December 5, 2024 21:08
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.

2 participants