• Skip to primary navigation
  • Skip to content
  • Skip to footer
Jeongmin's Log Version 1.0
  • Design Patterns
    • Design Patterns
      • Strategy Pattern
      • Observer Pattern
      • Decorator Pattern
      • Factory Method Pattern
      • Abstract Factory Pattern
      • Singleton Pattern
      • Command Pattern
      • Adapter Pattern
      • Facade Pattern
      • Proxy Pattern
      • Bridge Pattern
      • Structural Patterns (Comparison)
      • Template Pattern
      • Composite Pattern
      • Decorator vs Composite Pattern

    Design Patterns - Singleton Pattern

    On this page

    • UML
      • Singleton Pattern
    • Pseudo Code
    • Reference

    Key words: Global access point of the instance, Code Smell

    UML

    Singleton Pattern

    Singleton

    Pseudo Code

    
    class Singleton {
      static private Singleton instance;
    
      private Singleton() {}
    
      public static Singleton getInstance() {
        if(instance == null) {
          instance = new Singleton();
        }
        return instance;
      }
    }
    

    Reference

    • https://youtu.be/hUE_j6q0LTQ

    Tags: Singleton Pattern

    Categories: Design Patterns

    Previous Next
    • Feed
    © 2024 Jeongmin Oh. Powered by Jekyll & Minimal Mistakes.