Section 3: Module 3: Part 1: Command Processor Pattern (Part 1)

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

0:08 heavily used in the context of started services
0:42 command processor pattern
2:30 when people get more experience applying patterns to other context like distributed systems, 2:38 it became clear that the original context was too narrow => 2:41 from there grew the command processor pattern 2:44 it is *more about taking commands and passing them over to kinda command processor, where they are executed typically in different threads or different processes*
2:55 hard-pressed to extract that particular use case out of GOF patterns for command
3:29 context through which command processor pattern appears
3:33 context: we are going to want to be able to process some long-running action, which will end up blocking the UI thread
4:13 problems - if you do blocking calls from the main thread of control the UI thread, that is going to run the risk of triggering the "Application Not Responding" (ANR) the dialog
4:38 solution 4:44 *command processor pattern in order to encapsulate a download request as an object that you can pass from an activity that you don't want the block to a service where that thing can run in background threads and run at its leisure*
5:02 rationale of command processor pattern
6:38 what is the motivation of using the thread pool executor
7:32 you have potential for multiple things to happen
8:13 the intent of using the command processor pattern - 8:18 package a piece of application functionality - as well as its parameterization as an object - to make it usable in another context, such as later point in time or in a different thread
8:47 defer what you want to have done from when it gets done and how it is going to be done
9:17 applicability
9:21 decouple the decision of what pieces of code should be executed from the decision of when this should happen
9:38 change the implementation of service without breaking the client code that replies on it 10:05 avoid tight-coupling
10:10 10:15 (for UI)
11:48 structure & participants diagram, from the paper Command Revisited
13:48 dynamic diagram - sequence diagram
15:58 consequences of command processor pattern
16:01 + client does not get blocked for long duration of command processing
16:46 + allow different users to work with service in different ways via commands
18:28 - 18:37 additional programming to handle info passed with commands
19:44 two-way operations requires additional patterns & IPC mechanisms
20:42 known uses of command processor pattern
21:22 summary

ruixue