Re: Replacing objects

2008-12-23 Thread DAS
Thanks for the help guys, I agree, the way I had been thinking about it seemed like a strange way to go about dealing with the problem I was having. While this has started an interesting topic on NSProxy (seems like a really helpful class for implementing that pattern), I think my problem is going

Re: Replacing objects

2008-12-22 Thread Ken Thomases
On Dec 22, 2008, at 6:55 PM, Mike Abdullah wrote: No, the whole point is that although the proxy descends from a different hierarchy, no-one outside the proxy need know this. All other code treats it as though it were a non-proxy object of the expected class. Whenever one of the class's met

Re: Replacing objects

2008-12-22 Thread WT
On Dec 23, 2008, at 1:55 AM, Mike Abdullah wrote: On 23 Dec 2008, at 00:30, WT wrote: On Dec 23, 2008, at 1:04 AM, Kyle Sluder wrote: On Mon, Dec 22, 2008 at 6:03 PM, WT wrote: Of course, the proxy object's class has to share the same interface as the class of the objects it represents s

Re: Replacing objects

2008-12-22 Thread Shawn Erickson
On Mon, Dec 22, 2008 at 4:30 PM, WT wrote: > One is not obligated to use NSProxy to implement the Proxy pattern. I must > admit not being all that familiar with NSProxy, but having the proxy and the > object it stands for share the same public API (by being instances of > subclasses of the same a

Re: Replacing objects

2008-12-22 Thread Mike Abdullah
On 23 Dec 2008, at 00:30, WT wrote: On Dec 23, 2008, at 1:04 AM, Kyle Sluder wrote: On Mon, Dec 22, 2008 at 6:03 PM, WT wrote: Of course, the proxy object's class has to share the same interface as the class of the objects it represents so that your code doesn't need to know whether it'

Re: Replacing objects

2008-12-22 Thread WT
On Dec 23, 2008, at 1:04 AM, Kyle Sluder wrote: On Mon, Dec 22, 2008 at 6:03 PM, WT wrote: Of course, the proxy object's class has to share the same interface as the class of the objects it represents so that your code doesn't need to know whether it's dealing with a proxy or with the rea

Re: Replacing objects

2008-12-22 Thread Kyle Sluder
On Mon, Dec 22, 2008 at 6:03 PM, WT wrote: > Of course, > the proxy object's class has to share the same interface as the class of the > objects it represents so that your code doesn't need to know whether it's > dealing with a proxy or with the real thing. This isn't true in Objective-C. Take a

Re: Replacing objects

2008-12-22 Thread WT
Hi Dimitri, you can make use of the so-called Proxy design pattern. Write all your code in terms of a proxy object that stands in for the real thing. Then your code doesn't have to know, or care, whether the object you're manipulating comes from the server or is local. It's the responsibi

Re: Replacing objects

2008-12-22 Thread Ken Thomases
On Dec 22, 2008, at 4:09 PM, DAS wrote: Is it possible to replace an object with another object so that all pointers to that object now point to the new object? No. There are techniques you can use to achieve something similar, but I think the real problem is with your design. If you're

Replacing objects

2008-12-22 Thread DAS
Hey guys, I'm fairly new to cocoa development here, so please bear with me. Is it possible to replace an object with another object so that all pointers to that object now point to the new object? In other words: Ptr A -> object1 Ptr B -> object1 Ptr C -> object1 I want to replace object1 with ano