-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Dissolve BSFormatter #3230
Dissolve BSFormatter #3230
Conversation
BSFormatter was a statefull catch all type class with a huge interface. It had dependencies to globals and very many classes depended on it. It was hard to reason about code flow due to how tangled up things were, making refactoring attempts of higher level classes difficult. To Dissolve BSFormatter the following changes were made: - Move functions that only have 1 call-site to private functions on the caller. - Make functions that do not depend on local state static. - Move functions that are only depended on by the desktop project to DisplayUtils. - Move functions that are Parsing related to ParsingUtils. - Move remaining static functions to FormattingUtils. - Create interface CoinFormatter and class ImmutableCoinFormatter to handle statefull functions. - Remove dependency to globals by instantiating an instance in CoreModule and inject it via Guice.
this pr has too many import and whitespace changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the non-functional changes, we do not have the resources to filter that for you.
EDIT: substitute "non-functional" with "non-changes". Whitepaces, new lines, linebreaks, ...
Thanks a lot for attempting this code refactoring! I cannot say for actual reviewers (ripcurlx, sqrrm, freimar, ManfredKarrer) but here are my 5 cents. Context: I am a new contributor myself so please don't put to much weight into my comments.
Hope this helps! |
My understanding is that this PR is intended as pure refactoring so by definition there are no changes in behavior (at least not intentional). I think the key is is to make the same refactoring much more gradually so it becomes viable for you to review. |
i think florian is refering to the formatting and whitespace changes. |
First, you assume that everyone is using IntelliJ, that IntelliJ does not change its formatting default (which it did actually), and that IntelliJ is around as long as Bisq is around. Second, "stable across installations". that will never happen. Just take a look at any bigger project, even one that is not open-source, you will never find this level of "stability". so please keep formatting-only changes to a minimum, and let us try to focus on real work. |
8a64458
to
1f0d193
Compare
Thank you all for your comments. I have removed the OptimizeImports commit. I thought intellij was what the community had converged on since the Regarding making smaller PRs - I could do that but it would be quite some work not sure yet if I will get to it. |
@battleofwizards on the topic of reviewers. I think the task of reviewing is up to everyone contributing to the project. I see the maintainer role, ie, merge rights, as just a 'click the merge button when the PR has enough ACKs' kind of job. I will try to review PRs as I can and will merge when I see PRs with ACKs from reputable contributors and no NACKs. On your other points I agree, in particular making PRs easy to review is in the PR creator's own interest. If it's too hard I will likely prioritize other easier to review PRs. @bodymindarts I think most developers use intellij so to me it's not unreasonable to optimize imports and do other formatting by intellij. |
I'm closing this PR and will open smaller ones so that the individual steps become more evident. |
BSFormatter was a statefull catch all type class with a huge interface.
It had dependencies to globals and very many classes depended on it.
It was hard to reason about code flow due to how tangled up things were,
making refactoring attempts of higher level classes difficult.
To Dissolve BSFormatter the following changes were made:
These changes are motivated by the following design principles.
I assume these are not contentious and am omitting justification. Happy to discuss these points if there is dissent.
This refactoring is not an end state but an intermediate step in a larger refactoring I am attempting. Just want the PRs to stay focused.