Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I am learning design patterns.

I came across factory and strategy design pattern which looks quite overlapping and similar in use.

Both patterns use "new" keyword to return an object(factory) or return and algorithm(strategy).

Conceptually it seems different, factory is used for differed instantiation of similar group of classes. where as Strategy is used for switching between algorithms. But when i see their examples together, they look quite similar.

Can anyone help me with a suitable example to differentiate them and their proper usage.

Thanks in advance.
Posted
Comments
walterhevedeich 29-Apr-11 5:07am    
Tried google?

There is even a CodeProject article on the subject out there[^].
 
Share this answer
 
Google: Search result[^]

You can also search them individually both on Google as well as on CodeProject. Try to look at other examples (not sure of which one you are talking of!). If you are still confused then post related code snippets and post specific question related to the confusion you have. The more clear and specific you are, better the response you can expect - it would help you at the end to understand things more clearer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900