According to Wikipedia :
โIn object-oriented programming, a command template is a behavioral design template in which an object is used to encapsulate all the information needed to complete an action or trigger an event at a later time. This information includes the name of the method, the object that owns the method and the values โโfor the parameters method. "
And in accordance with the text of Professor Schmidt, the team has:
- Time-independent application logic execution. Encapsulating application logic allows it to be queued and executed at another point in time.
- Context-independent application logic execution. The separation between application logic and context allows the application to be run in separate contexts, for example, in a different thread or in a different state.
- Interchangeability of application logic. The separation between application logic and context makes it easier to share application logic.
If you encapsulate all the information in Intent , onHandleIntent works as an abstract method for executing commands, as described in the shell file .
Thus, instead of explicitly executing the executor to invoke the command, you simply delegate the execution of the command to the operating system.
So the questions are:
- Is IntentService a structure implementation for a command template?
- In the affirmative case, why do some Android MVP implementations explicitly implement their own executor instead of using the one provided by the infrastructure?
source share