Wednesday 18 April 2007

Facade Pattern

BLOG 10

Facade Pattern

Inorder for systems to be built efficiently and also managed, the whole system should be structured into sub-systems. Facade helps provide a simple interface to a complex subsystem.

This patterns can be used were there are many dependencies between clients and the implementation classes of an abstraction. This pattern can be used to decouple the subsystem from clients and other subsystems hence promoting subsystem independence and portability.

According to GOF, the intention of this pattern is to “Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.”[GoF]


[GoF] GoF, elements of reusable Object Oriented software, Page 157

3 comments:

MUINDE LILIAN - PAFSD said...

hi
excellent piece work, i appreciate the way you have simply explained this pattern. I agree with you that facade enable the system to be built efficiently and also managed through structuring it into sub-systems.
cheers
lilian

M Nuruzzaman said...

Hi Smith,

The Façade pattern has been well described in your blog. You tried to simplify the whole idea. But while I was reading your blog, I thought, use of an example could have made it even better. As the main idea of this blogging is to share thoughts, I would like to add an example to enrich the discussion.

Recently I ordered a Pay Monthly contract and mobile phone from O2. All I did was ordering it from the online interface and then received the phone and the SIM through DHL. There are other processes involved behind the scene.

The processes are: after I ordered the phone and paid, someone checked my Credit History if they could give me some credit. When I passed the credit check, the order went through and the customer service person sent the order to the warehouse. The warehouse checked if they had the phone I asked for and when confirmed about the availability, they prepared the order and contacted DHL to pick up the packet. DHL picked up the packet and delivered to me the next day. Now, if we see the whole process from Pattern’s point of view, the online interface is the Façade pattern that kept all the other processes, subclasses hidden from my view.

I hope that adds up with the discussion. Well done Smith.

Anonymous said...

Hey, I attempted to email you pertaining to this post but aren?t able to reach you. Please e-mail me when get a moment. Thanks.