Design Patterns

Here is the categories of design Patterns as introduced by Gang of four.
  • Creational - How objects are created
  • Structural - How objects relate to each other
  • Behavioural - How objects communicate with each other

Creational Patterns

Here is the list of creational patterns.
  • Singleton - Single object pattern - Log4j - only object is created
  • Prototype - similar to prototypical inheritance in JS - inherit from objects and not types
  • Builder - To build the object over the period of time. Method chaining is used
  • Factory - Page factory pattern in Selenium or factory functions in JS

Structural patterns

  • Facade - hide inner complexity. Class can have objects of other classes as members. JQuery is good example of Facade pattern as it hides the complexity and simplifies coding.
  • Proxy - used in Vue.js

Behavioural

  • Iterator - iterate though objects and keys. This is pull based system
  • Observer - This is push based system. Subscribe pattern.
  • Mediator - e.g. ATC - Air traffic controller. In expressjs, there is a middleware that can intercept request and response.
  • State - e.g. promises in JS - promise can be in pending, resolved or rejected state
  • Strategy pattern - e.g Passport JS

Web development and Automation testing

solutions delivered!!