Mar 19, 2009

Factory Method Pattern

As the name says, it is a pattern for mass production of similar (nearly similar) products (don't be afraid of produts, it means classes/components/objects).

In this pattern, a Client asks for a Product (e.g. some component) from Factory. Factory creates a product on request and deliver it to client. This way products can be seperated from being viewed by clients. Lets take an example:
Let's create a "Share This" functionality. This functionality is an example of factory method pattern because all share sites' buttons in your application have a common connection among them; they are to share your site on some social network. To understand this, let's have the factory architecture for this.
It can be easily understood that Share Button Factory creates all the share buttons for client and also seperate clients from products (social network buttons).

No comments:

Post a Comment

I Love Feedbacks/Comments