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 FilterWindow #3364

Merged
merged 1 commit into from
Nov 12, 2019
Merged

Refactor FilterWindow #3364

merged 1 commit into from
Nov 12, 2019

Conversation

lusarz
Copy link
Contributor

@lusarz lusarz commented Oct 3, 2019

In this pull request I introduced List<String> readAsList(InputTextField field) function. It allowed me to remove a few repetitions of code.

For example instead of:

if (!nodesInputTextField.getText().isEmpty()) {
    nodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(nodesInputTextField.getText()).split(",")));
}

I do:

List<String> nodes = readAsList(offerIdsInputTextField)

Finally I was able to eliminate temporary variables like nodes, bannedCurrencies etc, and invoke readAsList directly.


private List<String> readAsList(InputTextField field) {
if (field.getText().isEmpty()) {
return new ArrayList<>();
Copy link

Choose a reason for hiding this comment

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

Use Collections.emptyList() instead of new ArrayList<>().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Collections.emptyList() returns an immutable list, so operations like add will throw UnsupportedOperationException. Are we sure that these lists are not modified anywhere ?

Copy link

Choose a reason for hiding this comment

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

I'm not 100% sure how the result is being used. You can run Bisq with this change and open filter editor and see if anything blows up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I changed into Collections.emptyList() and did like you said - nothing wrong happened.

@lusarz lusarz requested a review from blabno October 9, 2019 08:10
blabno
blabno previously approved these changes Oct 9, 2019
Copy link

@blabno blabno left a comment

Choose a reason for hiding this comment

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

ACK

@lusarz
Copy link
Contributor Author

lusarz commented Oct 15, 2019

@ripcurlx merge ?

@ripcurlx
Copy link
Contributor

@ripcurlx merge ?

As this is a very sensitive view I want to test it myself before merging. But atm I'm focusing on the v1.2.0 release branch right now.

Just something general: Refactorings are great, but it would be better to do them in the future while implementing feaures/fixing bugs with direct user benefit. As reviewing PRs is a bottleneck we need to be efficient and try to reduce review times as much as possible.

@lusarz
Copy link
Contributor Author

lusarz commented Oct 18, 2019

@ripcurlx I'm trying to do small refactorings which eliminates code repetition, according to the Leave your code better than you found it. rule. They are rather easy to review - I'm explaining everything in pull request description.

Doing such a small refactorings help me to familiarize myself with the code.

@freimair
Copy link
Member

freimair commented Nov 1, 2019

please resolve the conflicts so we can merge it

@lusarz
Copy link
Contributor Author

lusarz commented Nov 4, 2019

@freimair Conflicts resolved

freimair
freimair previously approved these changes Nov 9, 2019
Copy link
Member

@freimair freimair left a comment

Choose a reason for hiding this comment

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

utAck. I did fire up the thing and created a filter. Everything works as I would expect it. @ripcurlx?

@ripcurlx
Copy link
Contributor

@ripcurlx
Copy link
Contributor

utAck. I did fire up the thing and created a filter. Everything works as I would expect it. @ripcurlx?

@freimair Why utACK and not ACK in that case?

Copy link
Contributor

@ripcurlx ripcurlx left a comment

Choose a reason for hiding this comment

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

NACK - please sign your commits. Besides that ACK. Tested it by filtering two currencies on Regtest.

@lusarz lusarz dismissed stale reviews from freimair and blabno via d2f6702 November 12, 2019 14:51
@lusarz
Copy link
Contributor Author

lusarz commented Nov 12, 2019

@ripcurlx Commit is singed now

@lusarz lusarz requested a review from ripcurlx November 12, 2019 14:58
@ripcurlx ripcurlx merged commit cc2df91 into bisq-network:master Nov 12, 2019
@lusarz lusarz deleted the refactor-filter-window branch February 4, 2020 09:18
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.

4 participants