Skip to content

Instantly share code, notes, and snippets.

@YozhEzhi
Created September 4, 2020 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YozhEzhi/ac999390032396c6dbd6792f5988313a to your computer and use it in GitHub Desktop.
Save YozhEzhi/ac999390032396c6dbd6792f5988313a to your computer and use it in GitHub Desktop.
/*
* ================================================================
* Creational patterns
* ================================================================
*/
/**
* Generating objects with Object.create().
* Object.create creates prototype chain for object extending.
* https://jsbin.com/resixu/19/edit?html,js,console
*/
/**
* Constructor pattern.
* https://jsfiddle.net/Yozh_Ezhi/raofhy5z/
*/
/*
* ================================================================
* Code Reuse Patterns (Structural)
* ================================================================
*/
/**
* The Inheritance Pattern
* https://jsfiddle.net/Yozh_Ezhi/4pgbscp2/
*/
/**
* Mixins.
* Mixing in methods to object.
* Notice that mixins could be hard to maintain in large project.
* We should make documentation of using mixins for team.
* https://jsfiddle.net/Yozh_Ezhi/fcwt9ur1/
*/
/**
* Decorator Pattern.
* Uses to change some initial properties and functionality.
* https://jsbin.com/qeyuja/16/edit?html,js,console
*/
/**
* The Command Pattern.
* https://jsbin.com/niyuga/8/edit?html,js,console
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment