GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - irynaO/JavaScript-Design-Patterns at 37425afb6388733b00b6a4be80bc426269661559

BranchesTags
Open more actions menu

Latest commit

 

History

43 Commits
43 Commits

Folders and files

NameName
Last commit message
Last commit date
GoF
GoF
 
 
misc
misc
 
 
.gitignore
.gitignore
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 

Repository files navigation

PatternifyJS: JavaScript Design Patterns

About

PatternifyJS is a reference of the main design patterns in the JavaScript world. External libraries are not covered, only the core languages are. Here is the list of all available languages:

  • ECMAScript (Vanilla)
    • ES5
    • ES6
  • CoffeeScript
  • TypeScript

The Gang of Four (GoF) patterns are based on original synopses inspired from the real life and are available in two distinct flavors: "classic" & "idiomatic".

The classic style emulates the principles of traditional class-based object-oriented languages like Java. Therefore, this style makes heavy use of abstraction, interfaces, classes, inheritance, composition, encapsulation and polymorphism. As a prototype-based language, JavaScript does not have all these functionalities natively (despite all the syntactic sugar introduced by ES6). But it is still possible to use and reproduce each of these concepts... For obvious reasons, constructor functions are the rule in the classic style. Moreover, each design pattern has its own class diagram in UML.

The idiomatic style reveals the true nature of JavaScript. Constructor functions and classes are replaced by factory functions and object literals, there is no abstraction anymore, encapsulation is reduced to the minimum and flexibility raised to the maximum. With this style, the GoF patterns are a bit difficult to recognize because their overall structure is blurred. But here it is more reasonable to think about objects directly, not about classes (see object diagrams in UML).

Apart from the GoF patterns, there are also miscellaneous (functional and more) patterns in JavaScript that make life easier. They can be of a great help!

Gang of Four (GoF) patterns

  • Creational

    • AbstractFactory (classic | idiomatic)
    • Builder (classic | idiomatic)
    • Factory (classic | idiomatic)
    • Prototype (classic | idiomatic)
    • Singleton (classic | idiomatic)
  • Structural

    • Adapter (classic | idiomatic)
    • Bridge (classic | idiomatic)
    • Composite (classic | idiomatic)
    • Decorator (classic | idiomatic)
    • Facade (classic | idiomatic)
    • Flyweight (classic | idiomatic)
    • Proxy (classic | idiomatic)
  • Behavioral

    • Chain of Responsibility (classic | idiomatic)
    • Command (classic | idiomatic)
    • Interpreter (classic | idiomatic)
    • Iterator (classic | idiomatic)
    • Mediator (classic | idiomatic)
    • Memento (classic | idiomatic)
    • Observer (classic | idiomatic)
    • State (classic | idiomatic)
    • Strategy (classic | idiomatic)
    • Template (classic | idiomatic)
    • Visitor (classic | idiomatic)

Miscellaneous patterns

  • Currying
  • Module
  • Object Specifier
  • Revealing Module

Inspiring resources

  • JavaScript: The Definitive Guide, David Flanagan
  • JavaScript: The Good Parts, Douglas Crockford
  • Learning JavaScript Design Patterns, Addy Osmani
  • Exploring ES6, Axel Rauschmayer
  • The Little Book on CoffeeScript, Alex MacCaw
  • TypeScript Deep Dive, Basarat Ali Syed

About

📎 ES5 + ES6 + CoffeeScript + TypeScript design patterns with some theory, real-world examples and UML diagrams

Resources

Readme
License
Activity

Stars

0 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.