android10 / Android-CleanArchitecture

This is a sample app that is part of a series of blog posts I have written about how to architect an android application using Uncle Bob's clean architecture approach.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does UseCase is the right name?

paramadharmika opened this issue · comments

I see in the code, there is a class called UseCase (abstract) which then implemented by several class i.e GetUserList and GetUserDetail. As far as my understanding a UseCase is a collection of action/behavior on a specific module, seeing the behavior I reckon your UseCase class is a "command" class i.e calling some action on the repository. Would it be better to name the abstract class as Command?

Looking forward to your thought.

Best Regards

Getting a user list is a valid use case, but in my opinion, the more appropriate use case class should be DisplayUserList, which handles the getting of the user list and the displaying of the list in the user list. So the use case would be to access the user list in a repository, and display it to the user interface.

Yes @crjacinro, I agree with you, the naming convention for me is a bit confusing. What tickle on my mind is, when there are multiple operation inside a use case, i.e involving multiple repository and each of the operation involving asynchronous op.
So for this code example I may or may not have answer my question by my self by thinking the all of the observables can still happen on buildUseCaseObservable method, and then simply return the end result.

I will mark this thread as closed for now. Thank you for your comment

Thank u all so much like I said B4 I am still learning n still have along way 2 go obviously ...