Design Patterns Learning Note 1

Source: Internet
Author: User

2016.4.25

Business is purpose: Take fire

Technique is method: Drill wood to take fire

The architect coordinates the relationship between business and technology and splits the main business (purpose/problem) into specific technical implementation plans

Inside the software company:

Architects need to know a lot about technology and have business acumen.

The so-called "architecture" is to break up a large system and then assemble it successfully.

The software architecture includes: Code Schemas and hardware deployment architectures that host code runs

Software development is cost-taking, considering project difficulty and development cycle.

Technical complexity is too high, the time cost of mastering this technology and the difficulty of later maintenance (later maintenance also need to train new staff to carry out maintenance) will greatly increase.

Therefore, small projects with high-tech must not be zoned.

Implementing a solution that simply solves the current problem may be less costly.

so often we will find that some small projects, instant projects or projects to be launched immediately is a process-oriented development route, using the software development model of side-by-side modification (Build and Fix model).

Remember, any change in requirements, the expansion of functionality is a cost.

Reference: Architecture Ramble (ix): clarify the relationship between technology, business and architecture http://kb.cnblogs.com/page/543110/

All design patterns are designed to facilitate post -code maintenance and added functionality ,

In fact, if only to solve the present problem, with the process-oriented design ideas more quickly and directly, because there are few changes in the main function of the cycle to increase the function of the implementation code can be

1. Loose coupling

-- separation of views and data models for later maintenance and extended functions

- -separate operation, and each operation (such as the subtraction of the calculator) is individually packaged into classes, written and modified separately

2. Object-oriented programming is to reduce the coupling of programs by encapsulation, inheritance and polymorphism,

Implementation of the program:

Maintainable--Just change the word

Reusable-this time you can use it again

Expandable-If you want to add a word (add a function), just a separate inscription can be added

Good flexibility-movable position can be moved freely

3. Simple Factory class ( object Generation Factory )--Solve object creation problem

Classes that are specifically used to instantiate objects (selectively)

4. The strategy mode --used to encapsulate the algorithm, simplifies unit testing, because each algorithm has its own class and can be tested individually through its own interface.

5. Strategy mode + simple factory

The policy pattern is used to encapsulate the algorithm,

A simple factory is used to generate objects,

When you need to use different strategies (algorithms) under different conditions , using the policy mode + simple factory, you can greatly simplify the client's code volume (the number of classes used is reduced).

Plus

This design pattern actually runs through the MVC idea as well:

The implementation of the 1. Specific algorithm (data model) Operationadd,

2. Call (Controller) operationfactory

3. Client (view) Operationmain

Phase separation, reduces coupling, facilitates individual testing of each module, and future function development

Reference: "Liar design Mode" Geoscience

Design Patterns Learning Note 1

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.