> > a *very* useful design pattern, whilst *public* Singleton > is incredibly > > difficult to enforce. You are best to have a private > Singleton (i.e. it is > > only visible to your code) and expose its interface via a Flyweight. > > ...and then there is no need for the Singleton Design Pattern -- just > instance the 'whatever' only once, it IS your code so that > ain't hard:-). Precisely - this is in essence the Singleton pattern, taken to its most basic level (there is and will ever be only one instance of the class), but doesn't require any of the baggage usually associated with the Singleton design pattern. It's still worthwhile calling it a "Singleton" (because it is), but no one else needs to know that. "Singleton" is a useful label so long as people understand that it means there is one and only one instance, not that "we've got all this code to attempt to prevent you from instantiating it again, although in some cases it doesn't quite work, so don't do that" ... Tim Delaney
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4