According to Wikipedia:
"In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters."
And according to professor Schmidt's text, a command has:
- Time-independent execution of application logic. The encapsulation of application logic allows to queue it and execute it at a different point in time.
- Context-independent execution of the application logic. The separation between application logic and context allows to execute the application in separate contexts, such as in a different thread or using a different state.
- Exchangeability of application logic. The separation between application logic and context allows to easier exchange the application logic.
If you encapsulate all information into an Intent
, the onHandleIntent
works as an abstract method to the command executor, just like described at command processor pattern text.
So the questions are:
- Is IntentService the framework implementation for command executor pattern?
- In affirmative case, why some Android MVP implementations explicitly implements its own executor instead of using the one provided by the framework?
Aucun commentaire:
Enregistrer un commentaire