Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-15 Thread Uli Kusterer
On 15.04.2013, at 12:44, Tom Davie wrote: > Note also – simply using your app delegate as a store for things that aren't > singletons, but only one of them is pointed at by your app delegate is also > horrific – you're just substituting one singleton for another. If it were only that! At least

Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-15 Thread Graham Cox
On 16/04/2013, at 10:18 AM, Graham Cox wrote: > I don't know what you mean by "dependency injection", it's not a term I've > heard of OK, I looked it up. I hadn't heard the term but I'm very familiar with the concept it refers to. Sometimes the service or dependent entity should be a singl

Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-15 Thread Graham Cox
On 15/04/2013, at 8:44 PM, Tom Davie wrote: > Wow, I really can't get my head around this one. You make bold statements > like "GLOBALS ARE BAD NEWS" (which I 100% agree with), but then follow up > with effectively "use singletons instead". Singletons bring with them 95% of > the problems g

Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-15 Thread Tom Davie
On 15 Apr 2013, at 00:25, Graham Cox wrote: > > On 14/04/2013, at 2:08 PM, YT wrote: > >> My struggle is partially due to my lack of experience in OOP. I just have >> not written enough OO code as of yet. AND I'm very new to Objective-C. >> Hence my lack of experience and working knowledge

Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-14 Thread Graham Cox
On 14/04/2013, at 2:08 PM, YT wrote: > My struggle is partially due to my lack of experience in OOP. I just have not > written enough OO code as of yet. AND I'm very new to Objective-C. Hence my > lack of experience and working knowledge of Objective-C. > > extern int gFoobar; > > I underst

Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-14 Thread Uli Kusterer
On 14.04.2013, at 06:29, Steve Mills wrote: > Oh, that's easy, once you know how to make singletons. OK, I wouldn't call it > easy, but it's the right thing to do. If the C++ Steve wrote helps you understand things better, here's a 1-to-1 translation of that code to the equivalent in Objective

Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Steve Mills
On Apr 13, 2013, at 23:08:41, YT wrote: > int gFoobar = 42; > > Then reference it elsewhere as: > > extern int gFoobar; > > I understand that solution and its working for me right now. I have a PreRun > Class that defines the object and I instantiate in main.m just before the > line > retu

Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread YT
First just to clear a distraction... I didn't want to actually create my own version of Preferences. In fact that was a mistake to even mention it. Sorry, I was flailing in my mind trying to describe what I was struggling with and out came Preferences as an example. Totally throw away the