Design Patterns: Singleton

6
3



This is the fifth of an eight part series where Robert is joined by Phil Japikse to discuss design patterns. A design pattern is a best practice you can use in your code to solve a common problem. In this episode, Phil demonstrates the Singleton pattern. This pattern restricts the instantiation of a class to one instance and provides global access to that instance.

Resources:

– Sample code:
– Design Patterns: Elements of Reusable Object-Oriented Software book:
– Head First Design Patterns book:

Nguồn:https://wijstaanvooronzegrondrechten.org/

6 COMMENTS

  1. Full list for this series:
    0. SOLID Design Patterns (start from here): https://www.youtube.com/watch?v=agkWYPUcLpg
    1. Design Patterns: Command/Memento: https://www.youtube.com/watch?v=zRbHlDeon3E
    2. Design Patterns: Strategy: https://www.youtube.com/watch?v=QZIvlny1Onk
    3. Design Patterns: Template Method: https://www.youtube.com/watch?v=MfAvs0n9uMs
    4. Design Patterns: Observer and Publish-Subscribe: https://www.youtube.com/watch?v=72bdaDl4KLM
    5. Design Patterns: Singleton: https://www.youtube.com/watch?v=sbML3xFHRbI
    6. Design Patterns: Factories: https://www.youtube.com/watch?v=JEk7B_GUErc
    7. Design Patterns: Adapter and Façade: https://www.youtube.com/watch?v=XYa0rmRMZ1Q
    8. Design Patterns: Decorator: https://www.youtube.com/watch?v=6PPMR0GWrZQ

  2. Thanks for this high quality series guys 🙂 Imho however this video needs more warnings. There are many who argue that *Singleton simply is bad practice*. Myself included. There's too much potential downside and not enough upside. For anyone interested I would recommend the Clean Code Talks by Miško Hevery or my video on Singleton. Clearly, people have different opinions, but I oppose usage of the static keyword altogether since it removes the object orientation from object oriented programming. Hence the Singleton pattern must also be opposed.

  3. Thanks for creating this awesome series!

    You should add part number in the title of the video. So it will be easier for us to find the first part of the series. If there's a playlist of this series, that'll be even more helpful!

LEAVE A REPLY

Please enter your comment!
Please enter your name here