java - Not able to understand the Proxy cons -


i reading proxy pattern in this article , understood example, this commentconfused me. comment states:

there 2 big problems proxies, in enterprise environments.

1) you can't self calls. example proxy transaction management or security. need make sure instead of doing self call, forward call proxy. makes simple classes complex.

2) there issues identity; examlpe hibernate proxy makes impossible reference comparison, though guarantee there not multiple object instances of same entity in session.

my questions:

  1. what meaning of self call?
  2. why can not reference comparison when both refers proxy object?

  1. "self call" refers calling method on same object, using othermethod() instead of var.othermethod(). since call on same object goes straight through this , not proxy, special treatment proxy apply doesn't happen.

  2. the runtime environment may fiddle around proxy object, , run risk of accidentally trying compare proxy business object hiding behind it, in case object passes this reference out somewhere , trying compare looks runtime (and gets proxy).


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -