00. Design Pattern

Introduction of Design Pattern

DesignPattern

Design Pattern for Software

  • In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. Wiki

The goal of Design Pattern is to make software easy to maintain. In this concept, Design Pattern is tightly related to Refactoring. If Design Pattern is where the target is, Refactoring is how to go. So, "Design Pattern" reflects the output structure of Refactoring.

5 Principles of OOP (SOLID)

  • "S"ingle Responsibility Principle(SRP)
    • One module has only own Responsibility
  • "O"pen Close Responsibility Principle(OCP)
    • A module is closed to modify, but opened to extend
  • "L"iskov Substitution Principle(LSP)
    • A child class can be replaced by a parent class
    • Common members of children are come from a parent class
  • "I"nterface Segregation Principle(ISP)
    • A specified interface is better than a common interface
  • "D"ependency Inversion Principle(DIP)
    • A client is not dependent on a concrete class, but an interface or an abstract class.

Overview

C++ Idioms

  1. CRTP: Curiously Recurring Template Pattern
  2. Thin Template: Fast and low memory consuming container
  3. RAII: Resource Acquisition Is Initialization
  4. Function Object: Overloaded () operation to use as a function
  5. Smart pointer: Class acting as a pointer
  6. NVI: Non Virtual Interface
  7. RTTI: Run Time Type Information

Design Pattern

Create

  1. Singleton: Have only one instance, and there is only one way to access the instance
  2. Abstract Factory: Have an interface for a factory to create instances which are in the same group.
  3. Factory Method: Determine which group is to create
  4. Prototype: Create a new instance which is the same as the previous instance.
  5. Builder: Different instances with the same procedure

Structure

  1. Adapter: Adopt middle layer to avoid interface conflict
  2. Proxy: Wraps sub system with middle layer class
  3. Bridge: Divide implementation and abstracts
  4. Facade: Replace complicated system with simple classes
  5. Composite: Make complex object with recursive compound
  6. Decorator: Add dynamic functionalities with recursive compound
  7. Flyweight: Share an instance among sibling instances which has the same arguments.

Execute

  1. Iterator: Enumerate elements in container and complex objects
  2. Visitor: Execute function to elements in container and complex objects
  3. Observer: Broadcast an event
  4. Mediator: Handle one request in all instances
  5. Chain of Responsibility: Send an event in order
  6. Template Method: Changes algorithms or policies
  7. Strategy: Capsulate algorithm
  8. State: Change behavior with state
  9. Command: Capsulate command
  10. Memento: Store and restore the state of the instance
  11. Interpreter:

Classification

  1. Event and Callback: Observer, Mediator
  2. Common & uncommon
    1. Virtual function: Template method, Factory method
    2. Interface: Strategy, State, Builder
  3. Middle layers: Adapter, Proxy, Bridge, Facade, Mediator
  4. Containers or Complex objects: Iterator, Visitor
  5. State and command: Command, Memento
  6. Event propagation: Observer, Chain of responsibility

COMMENTS

Name

0 weights,1,abstract class,1,active function,3,adam,2,Adapter,1,affine,2,argmax,1,back propagation,3,binary classification,3,blog,2,Bucket list,1,C++,11,Casting,1,cee,1,checkButton,1,cnn,3,col2im,1,columnspan,1,comboBox,1,concrete class,1,convolution,2,cost function,6,data preprocessing,2,data set,1,deep learning,31,Design Pattern,12,DIP,1,django,1,dnn,2,Don't Repeat Your code,1,drop out,2,ensemble,2,epoch,2,favicon,1,fcn,1,frame,1,gradient descent,5,gru,1,he,1,identify function,1,im2col,1,initialization,1,Lab,9,learning rate,2,LifeLog,1,linear regression,6,logistic function,1,logistic regression,3,logit,3,LSP,1,lstm,1,machine learning,31,matplotlib,1,menu,1,message box,1,mnist,3,mse,1,multinomial classification,3,mutli layer neural network,1,Non Virtual Interface,1,normalization,2,Note,21,numpy,4,one-hot encoding,3,OOP Principles,2,Open Close Principle,1,optimization,1,overfitting,1,padding,2,partial derivative,2,pooling,2,Prototype,1,pure virtual function,1,queue runner,1,radioButton,1,RBM,1,regularization,1,relu,2,reshape,1,restricted boltzmann machine,1,rnn,2,scrolledText,1,sigmoid,2,sigmoid function,1,single layer neural network,1,softmax,6,softmax classification,3,softmax cross entropy with logits,1,softmax function,2,softmax regression,3,softmax-with-loss,2,spinBox,1,SRP,1,standardization,1,sticky,1,stride,1,tab,1,Template Method,1,TensorFlow,31,testing data,1,this,2,tkinter,5,tooltip,1,Toplevel,1,training data,1,vanishing gradient,1,Virtual Copy Constructor,1,Virtual Destructor,1,Virtual Function,1,weight decay,1,xavier,2,xor,3,
ltr
item
Universe In Computer: 00. Design Pattern
00. Design Pattern
Introduction of Design Pattern
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXvUavVsX4rYm8cgKQ8rzps7pHmmEVtkIb66G2o5KZFCfjvO96SCEUdaw_DMYzSbdVrB8XvnaKN8ljEE7EBjutI2XvsBL-2BLdijjJRIpAOEpvlhOW-hfWP3ir3wbE488AwdFEu7WKbLgO/s0/
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXvUavVsX4rYm8cgKQ8rzps7pHmmEVtkIb66G2o5KZFCfjvO96SCEUdaw_DMYzSbdVrB8XvnaKN8ljEE7EBjutI2XvsBL-2BLdijjJRIpAOEpvlhOW-hfWP3ir3wbE488AwdFEu7WKbLgO/s72-c/
Universe In Computer
https://kunicom.blogspot.com/2017/09/00-design-pattern.html
https://kunicom.blogspot.com/
https://kunicom.blogspot.com/
https://kunicom.blogspot.com/2017/09/00-design-pattern.html
true
2543631451419919204
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy