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

Reduce number of Parser classes #119

Open
EFregnan opened this issue Oct 29, 2020 · 5 comments
Open

Reduce number of Parser classes #119

EFregnan opened this issue Oct 29, 2020 · 5 comments
Assignees

Comments

@EFregnan
Copy link
Contributor

EFregnan commented Oct 29, 2020

While working to expand the functionalities supported by the API, I noticed that so far we have followed the paradigm of having one Parser class per data type to extract: e.g., one for CommentInfo entities, one for CommitInfo entities, and so on.

However, this adds a lot of load in terms of parameters passed to the constructor of some classes (for example, ChangeApiRestClient or RevisionApiRestClient).
I think it would good to do something about it.

I would propose to cluster together related methods in a "bigger" parser class: e.g., we could have a ReviewerParser class that groups together the classes AddReviewerResultParser, SuggesterReviewerInfoParser, and ReviewerInfoParser.

What do you think? I believe it would benefit the usability of the code to improve this.
Also, I am open to any suggestion on how to do this.

Thank you!

@uwolfer
Copy link
Owner

uwolfer commented Oct 30, 2020

Sounds like an idea - would you like to do that for one example cluster, and then I can take a look?

@EFregnan
Copy link
Contributor Author

Sure, I will create a first "cluster" of parsers and open a PR so you can have a look.

@EFregnan
Copy link
Contributor Author

EFregnan commented Nov 1, 2020

I added a PR with an example of clusters. I think that proceeding in a similar fashion we could cut the number of parameters in the constructors of ChangeApiRestClient or RevisionApiRestClient without losing too much in terms of understandability of the code.

Let me know what you think.

@EFregnan
Copy link
Contributor Author

@uwolfer, I would like to add a folder parsers in gerrit-rest-java-client/src/main/java/com/urswolfer/gerrit/client/rest/http/changes/ to separate parser classes from the other classes (e.g., ChangeApiRestClient.java).

What do you think?

@uwolfer
Copy link
Owner

uwolfer commented Feb 15, 2021

@uwolfer, I would like to add a folder parsers in gerrit-rest-java-client/src/main/java/com/urswolfer/gerrit/client/rest/http/changes/ to separate parser classes from the other classes (e.g., ChangeApiRestClient.java).

What do you think?

Sounds reasonable to me.

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

No branches or pull requests

2 participants