Nice article, but adding Factory or Interface would have been a better choice than Singleton. Reason is that Singleton easily becomes an anti pattern: all too often programmers use it to easily access to all objects of a classes of which they only need one instance, effectively creating global variables. There are positive and negative consequences for each design pattern, which youโ€™ve skipped over too easily here.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store