
Hi Peter, --- Peter Dimov <pdimov@mmltd.net> wrote:
You should dislike singletons because they are global variables.
The problem with the above apporach is that most code will end up using the global demuxer because this is the path of least resistance. When it turns out that the code needs to be refactored to use a specific demuxer, the programmers would need to go over it with a fine-toothed comb and replace every implicit reference to the global demuxer with an explicit demuxer reference, passing that reference wherever necessary. It'd be a pain, and it'd be easy to miss some. Not to mention that the code that implicitly uses the global demuxer may be in a library for which the source is not available.
So yes, the easy case will be easier, but the hard case will be harder.
Good points. Scratch that idea. Cheers, Chris