Design pattern – the difference between facade and business delegation pattern
What is the difference between facade and business delegation design pattern Are they all used to hide business logic from the client?
Solution
The delegate stands between the client and the actual implementation. It usually hides / filters / extends some functions from the client
The facade provides a course granularity API that contains more complex logic and / or coordination. It usually bundles multiple implementations of collaborative work, usually for the convenience of the client
Each example from Java:
Delegate: collections Unmodifiablelist() returns a list that retains a reference to the original list and delegates it for all methods, but throws an exception if its mutator method is called
Facade: if you've seen a lot of code required for print a Java DOM XML document, the first thing you need to do is create a utility method to hide all the ugliness - this method can be regarded as an appearance