I believe that one of the main differences is the context of the problem.
Despite the fact that the problem can be solved using any template, the real problems are:
1: "How many changes caused by events depend on the general context?"
2: "How often are listeners expected to change?"
The classic case for the pick pattern best illustrates this when you have a complex user interface with many components, and updating each of them has a complex relationship with the state of other similar components.
Although you can solve this problem with the pub / sub pattern; in which your components listen for events and contain the logic necessary for updating, the context object (together with the event) carries all the necessary information. Here the advantage, obviously, is the correct encapsulation of the logic related to the component within itself. The downside is that if such components need to change frequently, then you need to completely replicate this logic in every new component that you introduce.
To use the pick, you need to enter another layer and get an additional abstraction from the components. These components become thinner as they deal only with the presentation (the appearance of the user interface), so they are very easy to change. The only problem I encounter with this approach is that the update logic now seems to extend to other components, and for any system upgrade, you will need to change the component and the intermediary if the behavior of the component also changes.
This is for me the main dilemma / compromise that we need to solve. Please correct me if I fail.
redzedi
source share