Comments (11)
@yelsane usually an interactor is usually called use case. It's a specific action that the user or our App starts. Usually an interactor tends to have just one execute
method, because the name of the interactor itself already gives enough info.
There are some variations of this, but that usually is the way to use it. If your interactors are having that meaning, then I don't see anything wrong on the flow you describe. Looks good to me.
from androidmvp.
Interactors are an important part of many clean architectures, and are use cases of the App. It's true they are not very important in this example if the only goal is to learn MVP.
from androidmvp.
Are Interactors used to manage data Like Model in MVP?
from androidmvp.
They are the part of the model that the presenters interact with, yeah.
from androidmvp.
Thank you very much
from androidmvp.
For every use case, for example getting user profile and updating user profile I should create a separate interactor?
from androidmvp.
I would create at least separate interfaces. In some cases both could be implemented by one class.
from androidmvp.
Hi Antonio. Got here after going through your site. I was hoping to get your advice about the flow I have going. It goes like this.
Activity > Presenter > Interactor > Helper
Activity < Presenter < Interactor < Helper
- Activity - represents the view.
- Presenter - the presenter class.
- Interactor - the class that directly interacts with the helper and presenter classes. One separate interactor for each Helper class, implementing pretty much the callbacklisteners and corresponding presenter methods.
- Helper - a specific class I use for Firebase DB calls.
Does how I use the interactor make sense here? Cheers!
from androidmvp.
@antoniolg Thank you so much for taking the time to provide feedback Antonio. I'll proceed with what I already have then. Cheers! 👍 👍
from androidmvp.
In this example you have made an interactor (which represents the model layer in MVP) instance in the presenter class but i know that model is represented as Singleton in the MVP architecture so is there a difference or affect on app performance
and which is better after all???
from androidmvp.
Well, singletons has their own problems. Main one is that it's difficult to implement, but also you have it in memory even when you don't use it.
If you are sure that it needs to be a singleton, I'd just make classes unaware of this implementation detail, by declaring the dependency in the constructor of the classes that use it.
from androidmvp.
Related Issues (18)
- Unit tests HOT 6
- Orientation Change HOT 2
- More advanced use cases HOT 6
- how make request for one api HOT 2
- Import this project HOT 2
- Scrren rotation HOT 2
- There is a loose coupling between View and Model in main package
- I'd like to create Mockito tests for the LoginPresenterImpl HOT 3
- Is this package structure correct? HOT 6
- Interactor being instantiated in the View HOT 4
- [Question] Which is better using contact? or dividing presenter between view interface? HOT 3
- Where to reach domain layer from MVP HOT 2
- DI with your MVP example HOT 2
- LoginInteractor中的一个小问题 HOT 2
- I have a problem in gradle build
- How about life cycles ? HOT 1
- Memory Leak in Activity? HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androidmvp.