This time, let's take a look at the application of the design mode in IssueVision. IssueVision mainly uses the OBSERVER (OBSERVER) mode and COMMAND (COMMAND) mode. today, let's take a look at the application of the OBSERVER (OBSERVER) mode in IssueVision, which plays an important role in IssueVision.
In this way, GoF defines the OBSERVER (OBSERVER) mode ------ defines a one-to-many relationship between objects. When the State of an object changes, all objects dependent on it are notified and automatically updated.
From the definition, we can see that the OBSERVER (OBSERVER) mode logically requires two sets of objects. first, it must have a publisher (Publish), also known as the object to be observed (usually called as the target Subject, which we will call as the target Subject later ), subscribe is also called Observer ). A target object corresponds to multiple observer objects. When the target object changes, all observer objects registered in the target object will be notified and automatically updated.
In the process of application development, user interfaces and business logic are often required to be separated to define clear boundaries. because the application must be able to quickly change the user interface and cannot have a joint impact on other parts of the application, and the business logic also changes and requires that all these changes have nothing to do with the user interface. observer is the most commonly used design pattern to solve this problem. It helps to clearly define the boundaries between objects in the system.
It is best to demonstrate this form. Viewers (table objects, bar chart objects, and pie chart objects) depend on the data object Subject, therefore, all changes to the data object Subject will notify them. however, they do not know each other's existence, and table objects do not know the existence of other table objects or other bar chart objects. there can be any number of observers for the data object Subject, and these observers can be notified when the Subject object changes, so that their State is synchronized with the Subject:
Well, there are so many concepts. Let's take a look at the implementation of the OBSERVER (OBSERVER) mode. I won't talk about the implementation of the general OBSERVER (OBSERVER) mode here. You can refer to the GoF design mode and Java and mode books. let's focus on. the implementation of the OBSERVER (OBSERVER) mode in the. NET Framework.
. The. NET Framework introduces delegation and events. They provide updates and more powerful methods to implement The OBSERVER (OBSERVER) mode. (For more information about delegation and events, see relevant documents ). if you are not familiar with delegation and events, implementing the OBSERVER (OBSERVER) mode requires a lot of work (as implemented in Java ). the following is a brief description of the implementation in IssueVision.