Android Design Pattern series (0)-Opening

Source: Internet
Author: User

====================================== 2011-08-26 ===================== ============================
Sometimes, the most difficult thing is persistence; sometimes the lack of belief.
====================================== 2011-08-07 ====================== ============================
From the time I joined the design model to about four years ago, I always wanted to be proficient one day. I sat down on my bed and looked around. I bought 7 or 8 books for the design model, I also read a lot of references and videos and used some of them. But today I finally stopped, sorted out, watched, and reflected. In short, I stopped today to make it better and go further.
If I am lucky enough to write this series to 23 + N, I think at least my technology will increase a lot of color for me and bring more strong confidence to me;
If I am lucky enough to write this series to 23 + N, I think at least I will not be so tempted when I go to the buyer's books. Maybe I am not deep, and you may not;
If I am lucky enough to write this series to 23 + N, I think at least I will know more about the later architecture and the underlying Android architecture, and I will see more clearly and further.
I think so myself, so I will stick to it. I want to finish it, write it down, write 23, write + N, write the SDK, and write other people's open-source projects, after writing open source, I write my personal projects, I write my personal projects, I write my own open source projects, at least I want to write what I think I should continue to write, this is also done!
That's what I think!
==================================== 2011-07-29 ======================== ============================
After reading the design patterns for many years, I also saw many design patterns. I also used several common design patterns in my work.
Android, including the source code and some open-source projects, uses many classic design patterns and is also very exciting.
I have been learning Android for some days. If you are free, check it out. Source code , Look at the open-source project Code And write code at work.
Today, I am brave enough to share my rough understanding of the Design Pattern Based on Android (actually Java). I hope I can get some advice from my colleagues and hope that the design capability can be further improved.
I will refer to the design pattern: the basis for reusable object-oriented software. I will explore the usage of various design patterns in Android, extract the core part, and use it as an example.
Because you do not need to write code, and the application scenarios are generally self-contained in Android, the intention introduction and UML Structure Drawing may be emphasized in this article, then, you need to refer to other materials for the specific design model and its extension.
Below I will list some important points:

The design model provides solutions to solve many software engineering problems.

There are three categories based on the purpose of the Mode:
1. Creation Mode: it is related to object creation.
2. Structured mode: A combination of processing classes and objects.
3. behavior mode: describes how classes or objects interact and how responsibilities are assigned.

Two basic principles of object-oriented design:
1. Programming for interfaces, rather than implementing programming.
2. Object combination is preferred, rather than class inheritance.

Five design principles of object-oriented design:
1. Single Responsibility Principle (SRP)
2. Open and closed principle (OCP)
3. liskov replacement principle (LSP)
4. Dependency inversion principle (DIP)
5. Interface isolation principle (ISP)

Design Pattern in 23:
1. Creation Mode:
(1). Factory method mode
(2). Abstract Factory Model
(3). creator Mode
(4). prototype mode
(5). Singleton Mode
2. Structural Mode:
(6). Adapter Mode
(7). Bridge Mode
(8). Combination Mode
(9). decoration Mode
(10). Appearance Mode
(11). metadata sharing
(12). Proxy Mode
3. behavior mode
(13). interpreter Mode
(14). template method mode
(15). Responsibility Chain Model
(16). Command mode
(17). iterator Mode
(18) intermediary Mode
(19). Memorandum Mode
(20) Observer Mode
(21). Status Mode
(22). Rule Mode
(23). Visitor Mode
In addition, people later found many new models, such as the empty mode.

The following lists several common problems that may lead to re-design. The design pattern may be used for analysis and solution:
1. Create an object by specifying a class displayed
2. dependencies on special operations
3. Dependency on hardware and software platforms
4. Dependency on object representation or implementation
5.AlgorithmDependency
6. Tight coupling
7. Extend functions by using the production subclass
8. The class cannot be easily modified.

Software design Odor:
1. Rigidity
2. Vulnerability
3. intractable
4. Viscosity
5. unnecessary complexity
6. unnecessary repetition
7. Obscure
......
All in all, in a word, this is the case of object-oriented features + principles + models.

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.