Frequently used Android Design patterns

Source: Internet
Author: User
In general, there are 8 types of Android design patterns that are commonly used: Singleton, factory, observer, Agent, command, adapter, composition, interview.

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

Factory mode: The production of fixed things, such as abstract class, the disadvantage is that the product changes trouble; like action movies and love movies, the person sends the same request to the server respectively. Can get the set of movies they want to see, the equivalent of different objects to the same request, the requirements are met.

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

Proxy mode: Give your own things to others to do. You can return the results separately. 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 an interface required by the user, such as Baseadapter to fit the ListView and spinner, since they have the same interface

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

Frequently used Android Design patterns

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.