option-staticExample: gcc–static hello.c–o HelloMaking a library of static functions1. Compile into intermediate file gcc–c Mylib.c–o mylib.o2. Packaged into a static function library ar cqs LIBMYLIB.A mylib.o3. Copy the prepared LIBMYLIB.A into the/usr/libUsing the static function library-LNAME:GCC when linking, only the C function library is linked by default, and for other libraries, you need to use the-l option to indicate that a link needs to be displayed.Example: Gcc–hello.c–lmylib–o Hell
A deep understanding of the JavaScript series (33): detailed explanation of the Strategy Mode of the Design Mode
This article mainly introduces a deep understanding of the JavaScript series (33): detailed explanation of the policy pattern of the design pattern. The policy Pattern Defines the algorithm family and encapsulates them separately so that they can repla
Rule Mode
The algorithm family is defined and encapsulated separately so that they can be replaced with each other, so that the algorithm changes are independent of the customers who use the algorithm.Meaning of pattern Nouns
Powerful, not only the model name, but the quality, characteristics, and constraints symbolic of a complete set of models
Use less words for better communication
At the design level, it will not be pushed down to trivial
that they do different flight movements at runtime. Let the duck class implement the interface, only let the duck have a behavior. So Joe, thinking of using the combination of prevention, when the Ducks need other flight function requirements, we can use the Setbehavior () way, the specific way of flight. CodePHPInterfaceflybehavior{ Public functionfly ();} classFlywithwingsImplementsflybehavior{ Public functionFly () {Echo"Fly with Wings \ n"; }} classFlywithnoImplementsflybehavior{ Public fun
/*** Book: Thinking in Java * Features: Fully decoupled, policy design mode * Here the Apply.process () method can accept any type of processor, apply it to an object, and then print the result * File: apply.java* Time: April 2, 2015 16:50:55* Author: cutter_point*/package lesson9interfaces.classprocessor;import static Net.mindview.util.print.*;import java.util.arrays;class processor{public String name () {return This.getclass (). Getsimplename ();} O
Purpose: Reduce dependencyDesign patterns correspond to different needs, design principles represent the eternal soul, in practice may not always abide by, but always keep in mind.1. Dependence reversal principle (dependence inversion Principle)2. Interface isolation principle (Interface segregation Principle)3. The principle of substitution on the Richter scale (Liskov Substitution Principle) 4. Opening and closing principle (Open Close Principle)5.
Design Pattern-strategy pattern and decoration pattern
Adhere to the principle that the client code is the entry of the program, and the constructor is the entry of the class, and understand the mode:[Policy mode] Strategy mode is a method that defines a series of algorithms. All algorithms have the same functions but are implemented differently. Release + releas
achieve the best result.(7) Using the function diagram method, we can design different test data through the validity of different period conditions.(8) For a clear business flow system, the scene method can be used throughout the test case design process, in the case of a comprehensive use of various test methods.(1) On the user's point of view, priority to use the scene method(2) Boundary value analysis
PHP/** * Policy mode * Policy mode helps build an object that does not have to contain logic itself, but is able to take advantage of algorithms in other objects as needed * The best practice when you can create an object-based, self-contained algorithm of interchangeable objects is to use the policy mode*/Interfacemath{functionCalc$op 1,$op 2);}classAddImplementsmath{ Public functionCalc$op 1,$op 2) { return $op 1+$op 2; }}classSubImplementsmath{ Public functionCalc$op 1,$op 2) {
Embedded Linux Development DirectionUnderlying:KernelDrivenBootloaderApplication:Have UI:ANDROID,QTNo UI: Web applicationsNetwork Secure transmission SystemThe server runs on a PC Linux system and the client runs in the Development Board. The client can upload the file to the server or download it from the server.System model1. Server1.1. Account Management SubsystemEmbedded database2.2. Transmission SubsystemOpenSSL encryption transfer mechanismThread Pool Technology Optimization2. Client2.1. T
definition: the policy mode belongs to the behavior pattern of the object. It is intended for a set of algorithms that encapsulate each algorithm in a separate class with a common interface, so that they can be replaced with each other. The policy pattern allows the algorithm to change without affecting the client.Class Diagram:Advantages:(1) The Strategy mode provides a way to manage the associated algorithm families. The hierarchy structure of a pol
SPI Controller WorkflowThe SPI Controller provides 2 SPI interfaces. Each SPI interface has two channels, the TX channel and the RX channel, respectively. The CPU writes the data to the FIFO, writes the data to the Spi_tx_data register, so that the contents of this register are automatically moved to the sending FIFO, and if the CPU is going to read the data from the receiving FIFO, it accesses the register spi_rx_data, The data that receives the FIFO is then automatically moved to the Spi_rx_da
Policy mode: defines the algorithm family, respectively encapsulated, so that they can replace each other, this pattern allows the algorithm to change independently of the customer using the algorithm.The algorithm family is separated from the object, then the algorithm object is defined in the object, and then the object processing algorithm is delegated.Single principle: package changes;Multi-use combination, less inheritance;Programming for the interface, not for the implementation of program
Policy mode is a method that defines a series of algorithms. From a conceptual point of view, all these algorithms perform the same job, but they only implement differently, it can call all algorithms in the same way, reducing the direct coupling between various algorithm classes and algorithm classes.
UML diagram:
According to the big talk design pattern-Chapter 2 shopping mall promotion case code, you can simply record the usage of the
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.