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

Group 2: Refactoring and documentation of ImportCSV.java #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

pvjosue
Copy link

@pvjosue pvjosue commented Sep 7, 2021

No description provided.

}
}

for (Pet p : petsToAdd) {

Choose a reason for hiding this comment

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

nice to also see such a solution ... you are the first ones so far that moved this functionality to end if all pets can be parsed...
it can get a bit tricky then to keep the same order of execution as intended by the original csv

* @param dateOfBirth
* @return SettingResponse
*/
private SettingResponse setDateOfBirth(Pet pet, String dateOfBirth) {

Choose a reason for hiding this comment

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

I like that you extracted and created this and the below functions, which fulfill one single purpose, are small and you also kept the indentations small :)

// the method has to renamed - it doesn't just import, it also deletes
List<Pet> petsToAdd = new LinkedList<>();
List<Pet> petsToDelete = new LinkedList<>();
for (String line : csv.split("\\r?\\n")) {

Choose a reason for hiding this comment

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

you could think about extracting the most contents of importPets to a new method, so importPets is only responsible about handling the request and the new method takes care of orchestrating the parsing and so on (probably you would have done this with more time :) )

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