3

However, in cases where the tests did not force the separation, and the smells of Rigidity and Fragility become strong, the design should be refactored using the Facade or Proxy patterns to separate the two responsibilities.

From : Agile Software Development: Principles, Patterns, and Practices

I understand how Facade can be used. I am not able to get how proxy would be helpful.

Can someone provide and example of how Proxy Pattern can be used for refactoring here. Thanks!

1

Given the example where you want to unit test some code that does CORBA or other remote call.

During the test phase you don't have the proper environment online. Refactoring this concern and creating a proper testable code can be achieved with a Proxy pattern, where your concrete proxy implementation would delegate the calls to another concrete class. That enables the separation of concerns quoted on your question.

UML of a PROXY Pattern

Then during a integration test you can actually test the remote behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.