Unifying singleton accessors

Matěj Laitl matej at laitl.cz
Sun Jul 7 12:55:39 UTC 2013


On 7. 7. 2013 Mark Kretschmann wrote:
> Hey all,
> 
> I really dislike that we use both "MyObject::instance()" and
> "The::myObject()" as singleton accessors. IMO we should just use the
> "instance()" pattern, as this is a common programming standard. The
> other pattern is weird and Amarok-specific, and it also requires extra
> boilerplate code.
> 
> Can we get rid of "The::myObject()" and standardize on "instance()"?

I'm +1 for every consistency increase so I'm inherently +1 for this one too.

However, on a bit more long-term scale, I have a different proposal for these. 
I'd love to deprecate the "plain" global singletons altogether and replace 
them with what I call "components", which are essentially singletons enhanced 
with life-time management and unified access pattern.

See http://mail.kde.org/pipermail/amarok-devel/2013-April/011837.html (second 
half of the mail) for a more complete proposal. I'd like if you could comment 
on that, Markey, as for example Edward did. Unless there are objections, I can 
start experimenting with the proposal, show-casing it on the CollectionManager 
(perhaps during Akademy).

	Matěj


More information about the Amarok-devel mailing list