policy mode (strategy): It defines a series of algorithms, encapsulates each algorithm, and allows them to be replaced with each other. The policy pattern allows the algorithm to change without affecting the customer using the algorithm. (Original: The Strategy Pattern defines a family of algorithms,encapsulates each one,and makes them interchangeable. Strategy l
Strategy (Policy) Pattern is translated into a Policy mode. It is one of 23 modes in Gof's classic design mode. This article will reference the actual project scenario to use the policy mode to transform the actual project, to illustrate the purpose of the Policy mode.
The following uses Strategy instead of Strategy (Policy) Pattern.
The core of Strategy:Strategy
Definition of the policy pattern: Define a series of algorithms and then invoke them according to the actual situationAn episode: Recently in the process of the project took over a more complex requirements, because it is the old project with a new framework refactoring, so you can see the previous code, draw the essence of the previous code, reuse some of the code available, so that they write a half-day. Of course, this topic is the strategy mode, w
Some friends in my blog home that post the top article said the following message: "How to make a keyword strategy when the website is online, for example, what keywords should be formulated in the prophase, what key words should be formulated in the middle and later, and how to formulate the strategy of keyword optimization in different periods, to achieve a best optimization
This article mainly introduces the Adapter mode in php design mode, and uses php to implement the Adapter mode. if you are interested, refer to it.
I. intentionDefine a series of algorithms, encapsulate them one by one, and make them replaceable. Policy mode allows algorithms to change independently of customers who use it.
Algorithms are used to change the rule mode.
II. Structure of policy mode
III. main roles in policy modeAbstract Strategy rol
the strategy model of Java and Schema (reprinted from http://www.cnblogs.com/java-my-life/archive/2012/05/10/2491891.html)
In Dr Shanhong's "Java and Schema" book, this describes the policy (strategy) pattern:
the policy pattern belongs to the behavior pattern of the object. The intention is to encapsulate each algorithm in a separate class with a common interface for a set of algorithms so that they can
Original source: http://www.cnblogs.com/java-my-life/archive/2012/05/10/2491891.html
In Dr Shanhong's "Java and Schema" book, this describes the policy (strategy) pattern:
the policy pattern belongs to the behavior pattern of the object. The intention is to encapsulate each algorithm in a separate class with a common interface for a set of algorithms so that they can be replaced by each other. The policy pattern allows the algorithm to change witho
Life CasesFor dating with different types of MM, different strategies should be used. For some, it is better to take a movie, for others, it is better to eat snacks, and for some, it is best to go to the beach for romance, the single goal is to get the attention of mm. The key is to catch up with a lot of strategy in the mm tip.Motivation in ComputerDuring the software building process, some objects may use a variety of algorithms, which may change fr
Statement: This series of blog reference "Big Talk design mode", author Geoscience.
The policy pattern defines a series of algorithms, encapsulates each algorithm, and allows them to be replaced with each other. The policy pattern makes the algorithm independent of the client using it, i.e. the algorithm that encapsulates the change.
Applicable scenarios:
1, multiple classes only differ in performance behavior, you can use the Strategy mode, a
Definition of a hybrid policyAssuming that pi represents the probability of adopting each pure strategy, we use PI (SI) to represent the probability that the participants adopt the strategy Si under the mixed strategy Pi, i.e. pi (SI) is the probability that pi gives pure strategy si.For example, in the game of scissor
The informatization strategy should ultimately form an overall information planning and strategic deployment. The final strategy consists of three most important components: information System architecture strategy, information infrastructure strategy, information resource integration
Directory
1. About the policy model
2. Detailed Strategy model
2.1 Policy Mode definition
2.2 UML class diagram for policy mode
3. Advantages of the Strategy model
3.1 An example of using a policy pattern
3.2 Comparison with other implementation methods
3.3 Advantages of using policy mode
4. Using the Factory method mode to improve the
Design pattern of a sentence: excessive design is a crime, to be realistic according to the project, no one design is one step, many functions are based on feedback to improve.1, background: In the actual development, we often meet the realization of some business functions, there are many different ways of implementation, users can choose one of the ways.For example, when you sort a series of data, we can choose bubble sort, quick sort, insert sort, heap sort, and so on. During the development
PHP design mode--strategy mode
Statement: This series of blog reference "Big Talk design mode", author Geoscience.
The policy pattern defines a series of algorithms, encapsulates each algorithm, and allows them to be replaced with each other. The policy pattern makes the algorithm independent of the client using it, i.e. the algorithm that encapsulates the change.
Applicable scenarios:
1, multiple classes only differ in performance behavior, you ca
Design Mode note-Strategy Mode VS simple factory Mode
Policy mode VS simple factory Mode
Strategy)It defines the algorithm family and encapsulates them separately so that they can replace each other. This pattern changes the algorithm and does not affect the customers who use the algorithm.
1. Composition-Abstract policy role: a policy class, usually implemented by an interface or abstract class. -Specific
Strategic--------------------------------------------------------------------------------
"Star", "Warcraft", "civilization" ... These are the familiar names of PC gamers, and it can be said that the strategic games represented by these games are typical of PC games, and that the players in the strategy game are the most loyal players in many PC game types. Strategic game is divided into round and immediate strate
/* Copyright Notice: Can be reproduced arbitrarily, please be sure to indicate the original source of the article and author information. */
Research on search engine cache strategy
Zhang Junlin
Timestamp:2005 year October
A The conclusion about search engine user query:
(1) The user query has a large proportion of repeatability. There are 30% to 40% user queries that are duplicate queries.
(2) Most duplicate user queries are re-accessed at short
From: Lu Zhenyu
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> // Strategy pattern -- Structural example Using System; //"Strategy"AbstractClassStrategy{//MethodsAbstractPublicVoidAlgorithminterface ();} // "Concretestrategya" Class Concretestrategya: Strategy{ // Methods Override
Objective:The simple Factory mode and strategy mode is the majority of programmers, in the study of design patterns in contact with the earliest, or in the work practice is also used in a relatively more than two design patterns.One is the creation type, the other is the behavioral type, however two different types of patterns, in some places also have a trace of similarities, at the same time in a certain scenario combined with, can play a particular
1. Concept
Policy mode: Encapsulates a specific set of behaviors and algorithms into classes to accommodate certain context contexts, which are policy patterns
2. function
Use policy mode to implement IOC, dependency inversion, control inversion
3. For example
If an e-commerce website system, targeting different groups of people to jump to different items, and all advertising sites show different ads
4. The problem to be resolved
1. Do not chang
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.