Head first design mode observation mode note

Source: Internet
Author: User

In fact, it is a bit similar to the relationship between the newspaper publishing house and the subscriber. An observer needs to make an intermediate layer to determine whether to update the data. In fact, this is designed to represent an interface for the observer, and then the subscriber inherits the observer interface. The relationship between the newspaper club and the subscriber is loose. When the newspaper club has something new, it directly updates the interface, and then the interface updates the subscriber. Public void measurementschanged (float temperature, float humidity, Float Pressure)

{

For (INT I = 0; I <observers. Size (); I ++)

{

....

}

}

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.