refactor: replace for:in over lambdas - #117
Conversation
We currently had many nested for each in order to loop over the different entities and construct our organization. It had reached a point in which it was really nested, lots of indentation and it was not sustaniable/scalable.
We currently had our `UserOptionRequest` inside the `shell` package and we were coupling the `github` pacakge to such request.
for:in over lambdas
plozanol
left a comment
There was a problem hiding this comment.
The GitHubUserOptionController new approach is clean and easy to read.
I see that we have 6 repositories collaborators here, and despite it seems to respect the single responsibility principle, I feel too many calls for a simple controller, and also that way will be more difficult unit test having to mock all of them.
Just thinking about applying Chain of Responsibility pattern here, and creating domain.services to encapsulate these internal use cases. This way every LoopThroughOrgs (or a better naming) should only call one repository collaborator and the next nested LoopThroughWhatEver use case. This flexibility will allow us to reuse these pieces with the DbController or other future approaches.
What do you think?
|
Completey agree 💪🏼, plus the teacher proposed using CoR patter for such case. I will apply this refactor in another task (so we can merge this). |
We currently had many nested for each in order to loop over the different entities and construct our organization. It had reached a point in which it was really nested, lots of indentation and it was not sustaniable/scalable.
Closes #104