Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Design Patterns

Design Patterns

Otemuyiwa Prosper

August 13, 2017
Tweet

More Decks by Otemuyiwa Prosper

Other Decks in Programming

Transcript

  1. ❖ Software Developer ❖ Consultant at Auth0 ❖ Open Sourcerer

    ❖ Self-Acclaimed Developer Evangelist ❖ Community Builder ❖ Jollof Rice Ambassador ❖ Google Developer Expert ❖ Homeless Man
  2. 3. They can prove to be a savior, or else

    they can make you & your code a mess.
  3. Behavioral Design Patterns 1 3 ❖ Mediator ❖ Observer ❖

    Strategy ❖ Visitor ❖ Iterator ❖ Command
  4. Creational Design Patterns 1 4 ❖ Builder ❖ Prototype ❖

    Singleton ❖ Factory ❖ Abstract Factory
  5. Structural Design Patterns 1 5 ❖ Facade ❖ Composite ❖

    Decorator ❖ Flyweight ❖ Adapter ❖ Bridge
  6. ..Know JavaScript? I’ll use it as an example to explain

    the common design patterns that you should know & take advantage of in your codebase.
  7. Goals 1. Ensure that only one instance of a class

    is created. 2. Provide a global point of access to the object.
  8. Goals 1. Specify the kind of objects to create using

    prototypical instance. 2. Create new objects by copying this prototype
  9. Goals 1. Encapsulate the request in an object 2. Allow

    the parameterization of clients with different requests.
  10. Goals 1. Outward appearance to the world which hides a

    different reality. 2. Simpler public interface to avoid calling many internal methods to get some behavior working. 3. Ability to directly interact with subsystems in a way that can be less prone to accessing it directly.
  11. Goals 1. Creates objects without exposing the instantiation logic to

    the client. 2. Refer to newly created object through a common interface.
  12. Goals 1. Similar to Mixins. Aim to promote code reuse

    2. Offer ability to add behaviour to existing classes in a system dynamically.
  13. Goals 1. Emulate the concept of classes. 2. Shield particular

    parts from global scope and make everything simple.
  14. Goals 1. Define a one to many dependency between objects

    so that when one object changes state, all its dependents are notified and updated automatically.