#singleton

Software Design Patterns (Singleton)

Published at July 24, 2020 ·  2 min read

Software patterns for me is one of the most exciting practices in software engineering, it encapsulate best practices that have been been “discovered” and/or created along the years of people writing software, this is going to be the start of a series of posts where I’m going to talk about some of the patterns that I find very useful. Singleton This defines a pattern for when you only need to create a single instance of a class for example let’s say you have a class that is heavy on the initialization or that the class belongs to a service that you are creating that you need to maintain either state or share the state between other sections of your app, it could even be a class that calls a third party service that you don’t want to be initializing every time that you need to call some function on it....