Popular Android Design Patterns

Source: Internet
Author: User
In general, there are 8 common Android design patterns: Singleton, factory, observer, Agent, command, adapter, composition, visitor.

Singleton mode: In order to make the system only one call object, the disadvantage is that the singleton makes the other program rely on it excessively, and the different singleton runs in the different process, makes the maintenance difficult;

Factory mode: The production of some fixed things, such as abstract class, the disadvantage is the product modification trouble; If the person likes action movies and love movies to send the same request to the server, they can get the movie set that they want to see, which is equal to the same request from different objects, and needs are satisfied.

Observer pattern: A object is monitored by multiple objects, such as a cache;

Proxy mode: Your own things to others to do, the results can be returned, such as asynchronous threads;

Command mode: Separates the calling object from the object, and the middleware coordinates the work between the two, such as the controller;

Adapter mode: Turns an interface into a user-required interface, such as Baseadapter can be adapted to the ListView and spinner, because they have the same interface

Compositing mode: Converts a one-to-many relationship into a pair of whole relationships, such as a ListView and adapter;

Popular Android Design Patterns

Related Article

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.