What is the difference between facade and business delegate design pattern?
Aren't both of them used for hiding business logic from the client?
Delegation is standing between the client and the actual implementation, usually hiding/filtering/augmenting certain functionality of the implementation from the client.
Facade is providing a course-grained API hiding more complex logic and/or coordination, usually bundling up several implementations that work together, and usually as a convenience to the client.
Examples of each from java:
Delegation: The Collections.unmodifiableList()
returns a List that keeps a reference to the original List and delegates to it for all methods, but throws Exceptions if its mutator methods are called.
Facade: If you've ever seen the ridiculous amount of code required to print a java DOM XML document, the first thing you do is create a utility method to hide all the ugliness - that method could be considered a facade.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With