Observer mode in Java Design Mode

Source: Internet
Author: User

Observe the Mode Observer
ArticleLink: http://lykke.iteye.com/blog/1309952
Two or more objects are expected. We call them subject and observer. When the status of one party changes,
The other party is notified. That is to say, as the observer side, it can monitor a specific state change of the subject,
And respond to it. A simple example is that when data in a user view is changed by a user, the backend database can be updated,
When the database is updated in other ways, the data display in the user view also changes.
The observer mode has nothing to do with depth. It uses Java inheritance and interfaces to set a state flag in the observer's abstract class,
This flag is used to determine whether to notify the observer object. While learning this model,
We should learn more about Java inheritance and flexible application of interfaces. In fact, all design patterns are inherited, interfaces, and multi-state flexible applications.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.