0
Answered

Question on Proxy Design Pattern

phv 7 Π»Π΅Ρ‚ Π½Π°Π·Π°Π΄ β€’ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ anonymous 7 Π»Π΅Ρ‚ Π½Π°Π·Π°Π΄ β€’ 1

Hi, regarding to Proxy design pattern. why do we need to create interface in proxy pattern instead of let  the client communication with proxy itself?

ΠžΡ‚Π²Π΅Ρ‚

ΠžΡ‚Π²Π΅Ρ‚
Answered

Hi!

Thanks for the question!


The Client should be able to deal with the Proxy and the Service directly. Proxy and Service should be interchangeable within the Client. For this to happen in most programming languages, the Proxy and Service classes should have some kind of common interface, be that the actual interface, or a common base class.

Please let me know if you have further questions.

ΠžΡ‚Π²Π΅Ρ‚
Answered

Hi!

Thanks for the question!


The Client should be able to deal with the Proxy and the Service directly. Proxy and Service should be interchangeable within the Client. For this to happen in most programming languages, the Proxy and Service classes should have some kind of common interface, be that the actual interface, or a common base class.

Please let me know if you have further questions.

БСрвис ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠΈ ΠΊΠ»ΠΈΠ΅Π½Ρ‚ΠΎΠ² Ρ€Π°Π±ΠΎΡ‚Π°Π΅Ρ‚ Π½Π° ΠΏΠ»Π°Ρ‚Ρ„ΠΎΡ€ΠΌΠ΅ UserEcho