Skip to content

cankush625/DesignPatterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns in Go and Java

Creational Design Pattern

  1. Factory Design Pattern
    Example UML for Factory Pattern:
    factory_design_pattern

  2. Abstract Factory Design Pattern
    Example UML for Abstract Factory Pattern:
    abstract_factory_design_pattern

  3. Singleton Design Pattern

    • Use this pattern when there must be exactly one instance of a class, and it must be accessible globally.
    • When the sole instance should be extensible by subclassing it.
      Example UML for Singleton Design Pattern:
      singleton_design_pattern
  4. Builder Design Pattern

  5. Prototype Design Pattern

  6. Object Pool Design Pattern

    • Use this pattern when the cost of object creation is high and the number of objects required at a time are low.
    • For example, the database connection object.
      Example UML for Object Pool Design Pattern:
      object_pool_design_pattern

Structural Design Patterns

  1. Adapter Design Pattern

    • Convert the interface of a class into another interface clients expect.
    • Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
      Example UML for Adapter Pattern:
      adapter_design_pattern
  2. Decorator Design Pattern

    • Use this pattern to attach additional responsibilities to an individual objects dynamically and transparently, that is, without affecting other objects.
    • Use for responsibilities that can be withdrawn.
    • Use when extension by subclassing is impossible.
      Example UML for Decorator Pattern:
      decorator_design_pattern
  3. Bridge Design Pattern

    • Use this pattern when we want to avoid a permanent binding between an abstraction, and it's implementation. This might be the case, for example, when the implementation must be selected or switched at run-time.
    • Both abstractions and their implementations should be extensible by subclassing them independently. We can combine abstractions and implementations and extend them independently.
    • Changes in the implementation of an abstraction should have no impact on client; that is, their code should not have to be recompiled.
    • We want to share an implementation among multiple objects (perhaps using reference counting), and this fact should be hidden from the client.
      Example UML for Bridge Pattern:
      bridge_design_pattern
  4. Composite Design Pattern

    • Use this pattern when we want to represent part-whole hierarchies of objects.
    • We want clients to be able to ignore the difference between compositions of objects and individual objects. Clients will treat all objects in the composite structure uniformly.
    • This pattern is useful when we want to represent structures like hierarchy (user hierarchy, role hierarchy), file system/directory structure, etc.
      Example UML for Composite Pattern: composite_design_pattern

Behavioural Design Patterns

  1. Strategy Design Pattern
    Example UML for Strategy Pattern:
    strategy_design_pattern

Domain Driven Design Patterns

  1. Repository Design Pattern
    Repository design pattern is used for providing abstraction to the data access logic. Using Repository Design Pattern, the business logic layer of your application need not have any knowledge on how data persistence happens beneath.
    Example UML for Repository Pattern:
    repository_design_pattern

About

Implementation of Design Patterns in Go and Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published