-
Notifications
You must be signed in to change notification settings - Fork 356
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: AbstractTrackerPersister should be more readable now [TECH-775] #9091
Conversation
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.
LGTM!
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.
It looks good to me, however, I'd prefer not to use nested classes and extract them in a separate package with that visibility
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.
In my opinion the code is not more readable, it is more compact and maybe hidden in a better way in a inner class but it is difficult to follow the flow of the code and understanding what is happening
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
CTX class is now in a separate file |
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.
@gnespolino thank you for taking the time to dig into making this class more readable 😄
I have to side with @enricocolasante that I do not think adding the TrackedEntityAttributeValueContext class helps in readability. I do think the changes you made to the AbstractPersiter are more readable though. So the flow in general and how you reduced nesting 😁 I believe it should be possible to move the code in TrackedEntityAttributeValueContext
back into the AbstractPersister
as private methods. Some of the methods as I commented, can also be inlined IMHO. We would still get the benefit of less nesting/more readable code without an extra abstraction.
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
...e-tracker/src/main/java/org/hisp/dhis/tracker/bundle/persister/AbstractTrackerPersister.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/hisp/dhis/tracker/bundle/persister/TrackedEntityAttributeValueContext.java
Outdated
Show resolved
Hide resolved
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.
Like we discussed on the call I leave it up to you if you go with this version or the "inline" version without the Context class 😄
Kudos, SonarCloud Quality Gate passed! |
as mentioned in #9069 the handle method looked too complex, so I tried to split it up and simplify it as much as possible.
Please besides reviewing the solution, also take some minutes to verify no major issues have been introduced.