Giter VIP home page Giter VIP logo

javascript-oop-design-patterns's Introduction

javascript-oop-design-patterns

Object Oriented Programming Design Patterns In JavaScript

Creational patterns

Creational mechanisms to create objects suitable for the sutiation they are working in. Constructor, Factory, Abstract, Prototype, Singleton, Builder

Structural patterns

Concerned with composition - identify simple ways to realize relationships (think dependency) between objects. Ensure that a part of the system can be changed without causing the requirement to make changes in other parts. Assist in recasting parts of the system which don't fit a particular purpose into those that do. Decorator, Facade, Flyweight, Adapter, Proxy

Behavioral patterns

Stremaline the communication between objects. Iterator, Mediator, Observer, Visitor

Creational

  • Factory - Creates instance of several types (classes) based on interfaced data or events.
  • Abstract factory - Creates instance of several families of types without detailing concrete types.
  • Builder - Separates object construction from representation, always create same type of object.
  • Prototype - Initialized instance used for copying or cloning.
  • Module - Private state scope achieved with IIFE and closure.
  • Singleton - A type with only a single instance with global access points.

Structural

  • Adapter - Matches different interfaces - incompatible interfaces can work together.
  • Bridge - Separate object interface from implementation.
  • Composite - A structure of (simple and composite) objects which makes the total object more than the sum of its parts.
  • Decorator - Dynamically add alternate processing to objects.
  • Facade - A single class that hides the complexity of an entire subsystem.
  • Flyweight - A fine-grained instance used for efficient sharing of information that is contained elsewhere.
  • Proxy - A placeholder object representint the true object.

Behavioral

  • Interpreter - A way to include language elements in an app to match gramar of intended language.
  • Template method - Creates shell of an algorithm in a method, then defers the exacts steps to a subclass.
  • Chain of Responsibility -Pass request between chain of object to find the one that can handle the request.
  • Command - Encapsulate a command request between a chain of objects to find the object that can handle the request.
  • Iterator - Sequentially access the elements of a collection without knowing the inner workings of the collection.
  • Mediator - Simplifies communication between classes - prevent classes from refering explicitly to each other.
  • Memento - Capture an object internal state to be able to restore it later.
  • Observer - A way of notifying change to a number of objects to ensure consistency.
  • State - Alter an object's behavior when its state changes.
  • Strategy
  • Visitor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.