Abstract Factory Patterns

  • This is a rarely used pattern. It exists only when you have factory patterns in the project.
  • Abstract factory expands on the basic factory pattern.
  • Abstract factory helps us to unite similar factory patterns classes into one unified interface. This leads to more simplified interface for the client.

65d74-dp8

Example:

Abstract Factory Patterns

 

Abstract Factory Patterns

 

Steps:

  • We have common an Interface or Abstract class

35bed-af1

  • The concrete classes implement this interface or abstract class.

43d7a-af2

  • Then a new factory class is created which takes care of object creation. A similar abstract factory class takes the decision of returning the asked factory object. This abstract class will be used by the client.

44e6e-af3

  • The client calls the static class object in above by creating an abstract class instead of the factory classes, as follows:

c38ee-af4

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s