Factory Pattern: Benefits

Currently Reading Designing Professional C++

1. (Main Benefit) factories abstract the object creation process; you can easily substitute a different factory in your program. Just as you can use polymorphism with the created objects, you can use polymorphism with factories. This approach leads to easily extensible programs; simply changing the factory instance can allow the program to work on a completely different set of objects and classes.
2. Centralize the object creation for a particular domain. This localization is often a better model of real-world creation of objects.
3. Able to use them alongside class hierarchies to construct objects without knowing their exact class.

Advertisements
This entry was posted in Book and tagged , , . Bookmark the permalink.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s