Skip to content

kadisin/PatternsPractise

Repository files navigation

Pattern Practise

Paragraphs

  • Facade
  • Adapter
  • Builder
  • Singleton
  • Facade

    Facade is pattern to manage subsystems

    In example we want to manage car open and close - we have already wroten three subsystems - manage door, temperature inside and air conditioner

    We could use facade to manage that subsystem as a one simple system/interface

    image

    Adapter

    Adapter is pattern to convert data/objects

    In example we have client who have xml data and service that need json data to send

    We have to implement adapter in the middle - some instance that will convert client data to correct data what service need

    In example we cast string -> string but in more serious implementation adapter interface could look like:

    public JsonData XmlToJsonConvert(XmlData data)

    image

    Builder

    Builder pattern is used to create instances with diffrent configurations

    In example we could build home with any combination of parameters: Garage, Garden and Swimming Pool

    image

    Singleton

    Singleton is pattern to have only one instance of object in global use

    Example is object to communication with database

    image

    Releases

    No releases published

    Packages

    No packages published

    Languages