skip to Main Content

Welcome

Say hello to the toggle bar. This is an optional section you can use to display any content you'd like. Simply select a page from the theme panel and the content of the page will display here. You can even use the drag and drop builder to create this! This is a perfect place for your company mission statement, alerts, notices or anything else.

Get In Touch

Email: support@total.com
Phone: 1-800-Total-Theme
Address: Las Vegas, Nevada

Our Location

togglebar-map

Compare Behavioral Design Pattern

Post Series: Behavioral Design Pattern

Compare

 Type  Usage

Example

Chain of Resp

 abstract class abstract class hold the next handle of next object in pipeline. The implement class handle request or pass to next object. Developer: code(), Leader: Lead() -> Chain
Manager: Handle

Command

Wrap Execute by a class Command  InsertCommand ADO.NET

Interpreter

Context: input & output
Expression: TerminalExpression, SumExpression
Interpret: Operator return the value of Expression
 Tính biểu thức

Iterator

Next() method  Access to element of a collection

Mediator

SendMessenger() method  Chat Room

Memento

Originator hold current state and setState operator
Memento hold current state
CareTaker hold all memento (store)
Undo, previous state
Đóng gói dữ liệu

Observer

Subject notify observers
observer update=> get state of subject => execute
Login (subject)
Logger, Mailer, Security

State

Context hold state object, give behavior
State hold changeable function
Print start, printing, end

Strategy

wrap behavior into an interface vehicle has go, fly behavior

Template Method

define steps allow the implementation of the individual steps

Header, Body, Footer section

Visitor

Defined many unrelated operations to perform on it.

Warrior, Wizard fight Monster

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top