Unity3D & C# 设计模式--23
23 design patterns.
Creational Patterns |
|
创建几个类似的类的一个实例 |
|
分离对象构造与它的表示 |
|
创建几个派生类的一个实例 |
|
要复制或克隆一个全然初始化的实例 |
|
5. Singleton单件 |
一个类仅仅能运行一个实例能够存在 |
Structural Patterns |
|
不同的类的接口相匹配 |
|
从事实上现分离对象接口 |
|
简单和复合对象的树形结构 |
|
9 .Decorator装饰者 |
动态加入到对象的责任 |
一个表示整个子系统的单个类 |
|
11. Flyweight享元 |
细粒度的实例用于高效共享 |
一个表示还有一个对象的对象 |
|
Behavioral Patterns |
|
13. Chain of Resp.职责链模式 |
一连串的对象之间传递请求的一种方式 |
将命令请求封装为一个对象 |
|
15. Interpreter解释器 |
方法包括程序中的语言元素 |
16. Iterator迭代器 |
按顺序訪问集合中的元素 |
17. Mediator中介者 |
定义简化的类之间的通信 |
18. Memento备忘录 |
捕获和还原对象的内部状态 |
19. Observer观察者 |
一种方式通知到类数目的变化 |
20. State状态 |
在其状态改变时。改变一个对象的行为 |
21. Strategy策略 |
封装在类的内部算法 |
22. Template Method模板方法 |
推迟算法到子类的确切步骤 |
23. Visitor訪问者 |
对一类没有改变定义新的操作 |
1 AbstractFactory抽象工厂
定义:
提供一个接口,而无需指定它们具体的类创建一系列相关或相互依赖对象。
使用频率: 高
UML 类图:
參与者:
类和对象參加这样的模式是:
- AbstractFactory (ContinentFactory)
- declares an interface for operations that create abstract products
- ConcreteFactory (AfricaFactory, AmericaFactory)
- implements the operations to create concrete product objects
- AbstractProduct (Herbivore, Carnivore)
- declares an interface for a type of product object
- Product (Wildebeest, Lion, Bison, Wolf)
- defines a product object to be created by the corresponding concrete factory
- implements the AbstractProduct interface
- Client (AnimalWorld)
- uses interfaces declared by AbstractFactory and AbstractProduct classes
在 C# 中的结构代码:
此结构的代码演示了创建对象的并行层次结构的抽象工厂模式。创建对象已经被抽象出来。并不须要在client代码中硬编码的类名称。
2 Builder生成器
定义:
分离复杂对象的构建与它的表示。相同的构建过程能够创建不同的表示。
使用频率: 中低
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Builder (VehicleBuilder)
- specifies an abstract interface for creating parts of a Product object
- ConcreteBuilder (MotorCycleBuilder, CarBuilder, ScooterBuilder)
- constructs and assembles parts of the product by implementing the Builder interface
- defines and keeps track of the representation it creates
- provides an interface for retrieving the product
- Director (Shop)
- constructs an object using the Builder interface
- Product (Vehicle)
- represents the complex object under construction. ConcreteBuilder builds the product's internal representation and defines the process by which it's assembled
- includes classes that define the constituent parts, including interfaces for assembling the parts into the final result
在 C# 中的结构代码:
此结构的代码演示了分步的方式在当中创建复杂对象的生成器模式。施工过程能够创建不同的对象表示形式,并提供高水平的控制对象的程序集。
3 FactoryMethod工厂方法
定义:
定义一个接口用于创建对象,可是让子类决定实例化哪个类。工厂方法同意推迟到子类的实例化的类。
使用频率: 高
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Product (Page)
- defines the interface of objects the factory method creates
- ConcreteProduct (SkillsPage, EducationPage, ExperiencePage)
- implements the Product interface
- Creator (Document)
- declares the factory method, which returns an object of type Product. Creator may also define a default implementation of the factory method that returns a default ConcreteProduct object.
- may call the factory method to create a Product object.
- ConcreteCreator (Report, Resume)
- overrides the factory method to return an instance of a ConcreteProduct.
在 C# 中的结构代码:
此结构的代码演示了工厂方法提供极大的灵活性。在创建不同的对象。抽象类能够提供一个默认的对象。但每一个子类能够实例化对象的扩展的版本号。
4 Prototype原型
定义:
指定要使用一个典型的实例,创建的对象的类型。通过拷贝这些原型创建新的对象。
使用频率: 介质
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Prototype (ColorPrototype)
- declares an interface for cloning itself
- ConcretePrototype (Color)
- implements an operation for cloning itself
- Client (ColorManager)
- creates a new object by asking a prototype to clone itself
在 C# 中的结构代码:
此结构的代码演示了在当中创建新对象通过复制已存在的对象(原型) 在同一类的原型模式。
5 Singleton单件
定义:
确保一个类仅仅有一个实例。并提供一个全局訪问点訪问它。
使用频率: 中高
UML 类图
參与者:
Theclasses and objects participating in this pattern are:
- Singleton (LoadBalancer)
- defines an Instance operation that lets clients access its unique instance. Instance is a class operation.
- responsible for creating and maintaining its own unique instance.
在 C# 中的结构代码:
此结构的代码演示能够创建单例模式确保了仅仅有单个实例 (单身人士) 的类。
6 Adapter适配器
定义:
将一个类的接口转换成客户希望的另外一个接口。
适配器让各类共同工作,否则无法因为不兼容的接口。
使用频率: 中高
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Target (ChemicalCompound)
- defines the domain-specific interface that Client uses.
- Adapter (Compound)
- adapts the interface Adaptee to the Target interface.
- Adaptee (ChemicalDatabank)
- defines an existing interface that needs adapting.
- Client (AdapterApp)
- collaborates with objects conforming to the Target interface.
在 C# 中的结构代码:
此结构的代码演示了适配器模式映射到还有一个类的接口,以便他们能够一起工作。这些不兼容的类可能来自不同的库或框架。
7 Bridge桥接
定义:
所以。这两个能够独立的变化,解耦及事实上现的一种抽象。
使用频率: 介质
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Abstraction (BusinessObject)
- defines the abstraction's interface.
- maintains a reference to an object of type Implementor.
- RefinedAbstraction (CustomersBusinessObject)
- extends the interface defined by Abstraction.
- Implementor (DataObject)
- defines the interface for implementation classes. This interface doesn't have to correspond exactly to Abstraction's interface; in fact the two interfaces can be quite different. Typically the Implementation interface provides only primitive operations, and Abstraction defines higher-level operations based on these primitives.
- ConcreteImplementor (CustomersDataObject)
- implements the Implementor interface and defines its concrete implementation.
在 C# 中的结构代码:
此结构的代码演示了桥接模式分离(分离) 从事实上现的接口。运行能够进化而不更改client所使用的对象的抽象。
8 Composite组合
定义:
组合成树状结构来表示部分总体层次结构的对象。复合同意client均匀地看待单个对象和对象的组合。
使用频率: 中高
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Component (DrawingElement)
- declares the interface for objects in the composition.
- implements default behavior for the interface common to all classes, as appropriate.
- declares an interface for accessing and managing its child components.
- (optional) defines an interface for accessing a component's parent in the recursive structure, and implements it if that's appropriate.
- Leaf (PrimitiveElement)
- represents leaf objects in the composition. A leaf has no children.
- defines behavior for primitive objects in the composition.
- Composite (CompositeElement)
- defines behavior for components having children.
- stores child components.
- implements child-related operations in the Component interface.
- Client (CompositeApp)
- manipulates objects in the composition through the Component interface.
在 C# 中的结构代码:
此结构的代码演示了所同意的树状结构,各个节点均匀訪问。不管他们是叶节点或分支(复合) 节点创建的复合模式。
9 Decorator装饰者模式
定义:
动态地将责任附加到对象的附加。为扩展功能,装饰者提供了比继承更灵活的替代方案。
使用频率: 介质
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Component (LibraryItem)
- defines the interface for objects that can have responsibilities added to them dynamically.
- ConcreteComponent (Book, Video)
- defines an object to which additional responsibilities can be attached.
- Decorator (Decorator)
- maintains a reference to a Component object and defines an interface that conforms to Component's interface.
- ConcreteDecorator (Borrowable)
- adds responsibilities to the component.
在 C# 中的结构代码:
此结构的代码演示了装饰者模式的动态地将额外的功能加入到现有的对象。
10 Facade外观模式
定义:
提供一组在一个子系统接口统一的接口。
外观定义了一个更高级别的接口使子系统更易于使用。
使用频率: 高
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Facade (MortgageApplication)
- knows which subsystem classes are responsible for a request.
- delegates client requests to appropriate subsystem objects.
- Subsystem classes (Bank, Credit, Loan)
- implement subsystem functionality.
- handle work assigned by the Facade object.
- have no knowledge of the facade and keep no reference to it.
在 C# 中的结构代码:
此结构的代码演示 Facade 模式,提供了一个简化和统一到一个大型的子系统的类接口。
11 Flyweight享元模式
定义:
使用共享来有效地支持大量细粒度的对象。
使用频率: 低
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Flyweight (Character)
- declares an interface through which flyweights can receive and act on extrinsic state.
- ConcreteFlyweight (CharacterA, CharacterB, ..., CharacterZ)
- implements the Flyweight interface and adds storage for intrinsic state, if any. A ConcreteFlyweight object must be sharable. Any state it stores must be intrinsic, that is, it must be independent of the ConcreteFlyweight object's context.
- UnsharedConcreteFlyweight ( not used )
- not all Flyweight subclasses need to be shared. The Flyweight interface enables sharing, but it doesn't enforce it. It is common for UnsharedConcreteFlyweight objects to have ConcreteFlyweight objects as children at some level in the flyweight object structure (as the Row and Column classes have).
- FlyweightFactory (CharacterFactory)
- creates and manages flyweight objects
- ensures that flyweight are shared properly. When a client requests a flyweight, the FlyweightFactory objects assets an existing instance or creates one, if none exists.
- Client (FlyweightApp)
- maintains a reference to flyweight(s).
- computes or stores the extrinsic state of flyweight(s).
在 C# 中的结构代码:
此结构的代码演示了在当中为数较少的对象由不同的client共享多次的Flyweight模式。
12 Proxy代理模式
定义:
提供代理项或还有一个对象的占位符以控制对它的訪问。
使用频率: 中高
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Proxy (MathProxy)
- maintains a reference that lets the proxy access the real subject. Proxy may refer to a Subject if the RealSubject and Subject interfaces are the same.
- provides an interface identical to Subject's so that a proxy can be substituted for for the real subject.
- controls access to the real subject and may be responsible for creating and deleting it.
- other responsibilites depend on the kind of proxy:
- remote proxies are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.
- virtual proxies may cache additional information about the real subject so that they can postpone accessing it. For example, the ImageProxy from the Motivation caches the real images's extent.
- protection proxies check that the caller has the access permissions required to perform a request.
- Subject (IMath)
- defines the common interface for RealSubject and Proxy so that a Proxy can be used anywhere a RealSubject is expected.
- RealSubject (Math)
- defines the real object that the proxy represents.
在 C# 中的结构代码:
此结构的代码演示了代理模式提供一个代表性的对象(代理) 控制着通往还有一个类似的对象。
13 Chain of Responsibility职责链模式
定义:
避免耦合的请求发件人对它的接收器,让多个对象有机会来处理该请求。
链的接收对象并传递链的请求。直到一个对象处理它。
使用频率: 中低
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Handler (Approver)
- defines an interface for handling the requests
- (optional) implements the successor link
- ConcreteHandler (Director, VicePresident, President)
- handles requests it is responsible for
- can access its successor
- if the ConcreteHandler can handle the request, it does so; otherwise it forwards the request to its successor
- Client (ChainApp)
- initiates the request to a ConcreteHandler object on the chain
在 C# 中的结构代码:
此结构的代码演示了几个链接的对象(链) 提供对请求作出回应或转交给行中的下一个对象的机会的责任链模式。
14 Command命令模式
定义:
将一个请求封装为一个对象。从而让您将參数化客户提供不同的请求、队列或日志请求,以及支持可撤销的操作。
使用频率: 中高
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Command (Command)
- declares an interface for executing an operation
- ConcreteCommand (CalculatorCommand)
- defines a binding between a Receiver object and an action
- implements Execute by invoking the corresponding operation(s) on Receiver
- Client (CommandApp)
- creates a ConcreteCommand object and sets its receiver
- Invoker (User)
- asks the command to carry out the request
- Receiver (Calculator)
- knows how to perform the operations associated with carrying out the request.
在 C# 中的结构代码:
此结构的代码演示了将请求存储为对象同意client运行或播放请求的命令模式。
15 Interpreter解释器模式
定义:
给定一个语言。定义和解释器使用该表示来解释语言中的句子。其语法的表示法。
使用频率: 低
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- AbstractExpression (Expression)
- declares an interface for executing an operation
- TerminalExpression ( ThousandExpression, HundredExpression, TenExpression, OneExpression )
- implements an Interpret operation associated with terminal symbols in the grammar.
- an instance is required for every terminal symbol in the sentence.
- NonterminalExpression ( not used )
- one such class is required for every rule R ::= R1R2...Rn in the grammar
- maintains instance variables of type AbstractExpression for each of the symbols R1 through Rn.
- implements an Interpret operation for nonterminal symbols in the grammar. Interpret typically calls itself recursively on the variables representing R1 through Rn.
- Context (Context)
- contains information that is global to the interpreter
- Client (InterpreterApp)
- builds (or is given) an abstract syntax tree representing a particular sentence in the language that the grammar defines. The abstract syntax tree is assembled from instances of the NonterminalExpression and TerminalExpression classes
- invokes the Interpret operation
在 C# 中的结构代码:
此结构的代码演示的翻译模式,利用定义的语法。提供口译员那过程解析语句。
16 Iterator迭代器
定义:
提供方法顺序訪问一个聚合对象元素,而又不暴露其内部表示。
使用频率: 高
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Iterator (AbstractIterator)
- defines an interface for accessing and traversing elements.
- ConcreteIterator (Iterator)
- implements the Iterator interface.
- keeps track of the current position in the traversal of the aggregate.
- Aggregate (AbstractCollection)
- defines an interface for creating an Iterator object
- ConcreteAggregate (Collection)
- implements the Iterator creation interface to return an instance of the proper ConcreteIterator
在 C# 中的结构代码:
此结构的代码演示了所提供的方法来遍历的迭代器模式(迭代) 的项的集合未作具体说明的基础结构的集合。
17 Mediator中介者模式
定义:
定义对象来封装一组对象的交互。调解员保持对象被明白地说,谈到彼此促进松散耦合,它让你独立地改变它们之间的交互。
使用频率: 中低
UML 类图:
參与者:
Theclasses and objects participating in this pattern are:
- Mediator (IChatroom)
- defines an interface for communicating with Colleague objects
- ConcreteMediator (Chatroom)
- implements cooperative behavior by coordinating Colleague objects
- knows and maintains its colleagues
- Colleague classes (Participant)
- each Colleague class knows its Mediator object
- each colleague communicates with its mediator whenever it would have otherwise communicated with another colleague
在 C# 中的结构代码:
此结构的代码演示了中介者模式促进松散耦合不同的对象和对象类型之间的通信。调解员是通过它的全部交互都必须都发生的中心枢纽。
18 Memento备忘录模式
定义:
没有违反封装,捕获和外部对象的内部状态,以便对象能够以后恢复到此状态。
使用频率: 低
UML 类图
參与者
Theclasses and objects participating in this pattern are:
- Memento (Memento)
- stores internal state of the Originator object. The memento may store as much or as little of the originator's internal state as necessary at its originator's discretion.
- protect against access by objects of other than the originator. Mementos have effectively two interfaces. Caretaker sees a narrow interface to the Memento -- it can only pass the memento to the other objects. Originator, in contrast, sees a wide interface, one that lets it access all the data necessary to restore itself to its previous state. Ideally, only the originator that produces the memento would be permitted to access the memento's internal state.
- Originator (SalesProspect)
- creates a memento containing a snapshot of its current internal state.
- uses the memento to restore its internal state
- Caretaker (Caretaker)
- is responsible for the memento's safekeeping
- never operates on or examines the contents of a memento.
在 C# 中的结构代码
此结构的代码演示了纪念品模式的暂时保存和还原还有一个对象的内部状态。
19 Observer观察者模式
定义
定义对象之间的一个一对多依赖性,以便当一个对象改变状态,其全部依赖项都通知和自己主动更新。
使用频率: 高
UML 类图
參与者:
Theclasses and objects participating in this pattern are:
- Subject (Stock)
- knows its observers. Any number of Observer objects may observe a subject
- provides an interface for attaching and detaching Observer objects.
- ConcreteSubject (IBM)
- stores state of interest to ConcreteObserver
- sends a notification to its observers when its state changes
- Observer (IInvestor)
- defines an updating interface for objects that should be notified of changes in a subject.
- ConcreteObserver (Investor)
- maintains a reference to a ConcreteSubject object
- stores state that should stay consistent with the subject's
- implements the Observer updating interface to keep its state consistent with the subject's
在 C# 中的结构代码:
此结构的代码演示了观察者模式已注冊的对象的通知和更新状态更改。
20 State状态模式
定义:
同意对象在其内部状态改变时改变它的行为。该对象将会出现改变它的类。
使用频率: 介质
UML 类图
參与者:
Theclasses and objects participating in this pattern are:
- Context (Account)
- defines the interface of interest to clients
- maintains an instance of a ConcreteState subclass that defines the current state.
- State (State)
- defines an interface for encapsulating the behavior associated with a particular state of the Context.
- Concrete State (RedState, SilverState, GoldState)
- each subclass implements a behavior associated with a state of Context
在 C# 中的结构代码:
此结构的代码演示了同意一个对象的行为以不同的方式取决于其内部状态的状态模式。
行为上的差异被委派给代表此状态的对象。
21 Strategy策略模式
定义:
定义一系列算法,封装每一个,让他们能够互换。
策略使得算法可独立于使用它的客户而变化。
使用频率: 中高
UML 类图
參与者:
Theclasses and objects participating in this pattern are:
- Strategy (SortStrategy)
- declares an interface common to all supported algorithms. Context uses this interface to call the algorithm defined by a ConcreteStrategy
- ConcreteStrategy (QuickSort, ShellSort, MergeSort)
- implements the algorithm using the Strategy interface
- Context (SortedList)
- is configured with a ConcreteStrategy object
- maintains a reference to a Strategy object
- may define an interface that lets Strategy access its data.
在 C# 中的结构代码:
此结构的代码演示了战略模式的封装形式的对象的功能。这同意client动态改变算法的策略。
22 Template Method模板方法模式
定义:
在操作中,将一些步骤交给子类定义骨架的一种算法。模板方法同意子类而无需更改该算法结构又一次定义算法的某些步骤。
使用频率: 介质
UML 类图
參与者:
Theclasses and objects participating in this pattern are:
- AbstractClass (DataObject)
- defines abstract primitive operations that concrete subclasses define to implement steps of an algorithm
- implements a template method defining the skeleton of an algorithm. The template method calls primitive operations as well as operations defined in AbstractClass or those of other objects.
- ConcreteClass (CustomerDataObject)
- implements the primitive operations ot carry out subclass-specific steps of the algorithm
在 C# 中的结构代码:
此结构的代码演示模板方法提供骨架的调用序列的方法。
一个或多个步骤能够推迟到子类,而不改变总体的调用顺序运行这些步骤。
23 Visitor訪问者模式
定义:
代表结构元素的对象运行的操作。訪问者同意您定义新的操作,而无需更改它所操作的元素的类。
使用频率: 低
UML 类图
參与者
Theclasses and objects participating in this pattern are:
- Visitor (Visitor)
- declares a Visit operation for each class of ConcreteElement in the object structure. The operation's name and signature identifies the class that sends the Visit request to the visitor. That lets the visitor determine the concrete class of the element being visited. Then the visitor can access the elements directly through its particular interface
- ConcreteVisitor (IncomeVisitor, VacationVisitor)
- implements each operation declared by Visitor. Each operation implements a fragment of the algorithm defined for the corresponding class or object in the structure. ConcreteVisitor provides the context for the algorithm and stores its local state. This state often accumulates results during the traversal of the structure.
- Element (Element)
- defines an Accept operation that takes a visitor as an argument.
- ConcreteElement (Employee)
- implements an Accept operation that takes a visitor as an argument
- ObjectStructure (Employees)
- can enumerate its elements
- may provide a high-level interface to allow the visitor to visit its elements
- may either be a Composite (pattern) or a collection such as a list or a set
在 C# 中的结构代码
此结构的代码演示怎样訪问者模式。对象遍历对象结构。并在此结构中运行相同的操作。每一个节点上。
不同的訪客对象定义不同的操作。
Unity3D & C# 设计模式--23的更多相关文章
- 再起航,我的学习笔记之JavaScript设计模式23(中介者模式)
中介者模式 概念介绍 中介者模式(Mediator):通过中介者对象封装一系列对象之间的交互,使对象之间不再相互引用降低他们之间的耦合,有时中介者对象也可以改变对象之间的交互. 创建一个中介 中介者模 ...
- Java设计模式23种(搞笑版) (转)
昨天做了一下支付宝的笔试题目被打击了,大量的逻辑推理和数学规律运算题目,其中还有问道Java设计模式的题目,一点都不知道,今天看到一份不错的介绍,非常好理解,作者是谁我没有办法考证,但是所有权 ...
- GoF设计模式-23大设计模式(表格)-程序员必备+必背
在GoF经典著作<设计模式:可复用面向对象软件的基础>中一共描述了23种设计模式. <Design Patterns:Elements of Reusable Object-Orie ...
- [设计模式] 23 访问者模式 visitor Pattern
在GOF的<设计模式:可复用面向对象软件的基础>一书中对访问者模式是这样说的:表示一个作用于某对象结构中的各元素的操作.它使你可以在不改变各元素的类的前提下定义作用于这些元素的新操作.访问 ...
- C#设计模式(23种设计模式)
转自:http://www.cnblogs.com/abcdwxc/archive/2007/10/30/942834.html 创建型: 1. 单件模式(Singleton Patte ...
- java设计模式-----23、命令模式
概念: Command模式也叫命令模式 ,是行为设计模式的一种.Command模式通过被称为Command的类封装了对目标对象的调用行为以及调用参数. 命令模式(Command Pattern)是一种 ...
- 设计模式(23)--Visitor--访问者模式--行为型
作者QQ:1095737364 QQ群:123300273 欢迎加入! 1.模式定义: 访问者模式是对象的行为模式.访问者模式的目的是封装一些施加于某种数据结构元素之上的操作.一旦 ...
- 设计模式23:Visitor 访问者模式(行为型模式)
Visitor 访问者模式(行为型模式) 动机(Motivation)在软件构造过程中,由于需求的改变,某些类层次结构中常常需要增加新的行为(方法),如果直接在基类中做这样的修改,将会给子类带来繁重的 ...
- C#设计模式(23)——备忘录模式(Memento Pattern)
一.引言 在上一篇博文分享了访问者模式,访问者模式的实现是把作用于某种数据结构上的操作封装到访问者中,使得操作和数据结构隔离.而今天要介绍的备忘者模式与命令模式有点相似,不同的是,命令模式保存的是发起 ...
随机推荐
- Bullet:MySQL增强半同步参数rpl_semi_sync_master_wait_point值AFTER_SYNC和AFTER_COMMIT的对比实验
MySQL 5.7.22启用增强半同步复制 MySQL对该参数值的描述 Semisync can wait for slave ACKs at one of two points, AFTER_SYN ...
- centOS取消锁屏
自己在使用虚拟机运行centos 7时,centos 7默认几分钟不动就锁屏,实在很讨厌,所以在设置中将其去掉 1.左上角点击应用程序,在下面选择系统工具,在系统工具中选择设置 2.选择设置下面的隐私 ...
- [Python3网络爬虫开发实战] 2.4-会话和Cookies
在浏览网站的过程中,我们经常会遇到需要登录的情况,有些页面只有登录之后才可以访问,而且登录之后可以连续访问很多次网站,但是有时候过一段时间就需要重新登录.还有一些网站,在打开浏览器时就自动登录了,而且 ...
- 编译Nginx, 并使用自签证书实现https访问
1. 编译安装nginx1.8.1 [root@centos7 nginx-1.8.1]# ./configure --prefix=/usr/local/nginx.1.8.1 --with-htt ...
- 理解ZAB协议
ZAB协议 介绍 1.zab协议是为分布式协调服务zookpeer专门设计的一种支持崩溃恢复的原子广播协议 2.在zookeeper中主要依赖ZAB协议来实现数据一致性,基于该协议zk实现了一种主备模 ...
- vue-router 根据路由动态添加目录 控制目录权限
<template> <el-row class="el-menu" > <el-menu router :default-active='$rout ...
- 【03】Html书写规范
[03] Html书写规范 1.推荐使用html5的文档声明 <!DOCTYPE HTML> 2.必须申明文档的编码charset,且与文件本身编码保持一致,推荐使用UTF-8编码 ...
- Webdriver测试脚本1(打开网页并打印标题)
案例: 启动火狐浏览器 首页打开博客园页面,打印网页标题,等待3秒 打开百度首页,打印网页标题,再等待2秒 关闭浏览器 from selenium import webdriver from time ...
- Android OkHttp(1)
Android OkHttp(1) OkHttp是一个流行的第三方开源网络请求框架,在目前的一些APP开发中比较流行.Android平台开源的网络请求框架不少,比如常见的Volley, Asyn ...
- 在win10配置环境变量
从win7升级成win10后找不到在哪配置环境变量...手动再见ヾ( ̄▽ ̄)Bye~,废话不多说,下面开始图文模式: 1)打开文件资源管理器,点左上角的"计算机"