Ubiquitous Design Pattern in Android: simple factory pattern and Agent Pattern

Source: Internet
Author: User

Recently, I have been studying some specific design patterns.CodeIt is found that there are quite a few places to use the design pattern in the android source code. Good systems must focus on good design, but on scalability and maintenance. This article introduces some simple design pattern types used in phoneservice:

 

1. Simple factory mode:

Note: I personally think this factory mode is slightly different from the standard factory mode. The standard is that there are clients to decide which instance to create. For example, if you want to use gsmphone, generally, use phone = phonefactory. makegsmphone (), so there is a possibility of improvement...

 

2. Proxy mode:

Note: In the proxy mode, the client does not need to know gsmphone and cmdaphone. It only needs to maintain a proxy object to complete Column Operations.

 

Other models will be updated continuously in the follow-up blog. If you say something wrong, please click it ~

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.