On May 3, 2011, at 4:08 PM, Martin Batholdy wrote:

> Now how can I make sure that a global data-source is available independent 
> from instances and their state?
> How can I share data between objects?

I would recommend making a singleton "manager" object that holds instances of 
this data handler object, and can be used to query these objects. We do this 
with data stores in several of our projects, and it works quite well. You may 
only have one data store object at this time, but if you ever need to add more 
than one, it's cheaper to adopt this design now than it is to uproot things 
later.

> I read something about singletons and that  by declaring the DataHandler 
> object a singleton I can make sure that over the whole program only one 
> DataHandler-instance is initiated,
> and the actual Data-Array is the same in each instance.
> 
> But I also read that singletons are bad practice.

That is not true. Where did you read that?

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to