On Dec 23, 2008, at 1:04 AM, Kyle Sluder wrote:

On Mon, Dec 22, 2008 at 6:03 PM, WT <jrca...@gmail.com> 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 look at NSProxy, the canonical
implementation of the very pattern you're describing.  To state this
is to completely miss the characteristics that define Objective-C.

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 abstract class) seems to me to be a good thing since the object and its proxy can be transparently swapped in code. If I understand NSProxy correctly, you lose that transparency when you use it, because NSProxy and NSObject are in different inheritance trees.

Like Ken said, you're probably doing something very wrong.

Not me, but Dimitri. I agree, though, that his design can be improved so he won't need to do what he described.

Wagner
_______________________________________________

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