Tuesday
Apr142009
C# Design Patterns: the Façade pattern
Tuesday, April 14, 2009 at 11:10PM Summary
Access multiple classes in one simple to use class. This class is often static too.
Example
A common use of the Facade pattern is with data access managers, a facade class that contains only static methods for CRUD operations. Another example might be a class that handles payment in an online store. This fascade class would link into multiple payment providers (paypal, visa/mastercard) as well as updating any order details in a database table. Rather than making the UI perform 10-20 lines of code, this could be done in a simple CheckoutManager.ProcessPayment(...) method. The minor setback of this of course is handling return codes.
A working example of a set of facade classes can be found in the Roadkill Managers folder.






Reader Comments