0

Confused between factory/abstract factory and strategy pattern in python-pls help

Aditya Patel 2 Π³ΠΎΠ΄Π° Π½Π°Π·Π°Π΄ β€’ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ Serhii Doroshenko 2 Π³ΠΎΠ΄Π° Π½Π°Π·Π°Π΄ β€’ 1

After reading the chapters on factory/abstract factory and strategy 3 times and reading the previous responses, I am still very confused as to what is the difference between the abstract/regular factory pattern and a strategy pattern? Yes factory creates objects whereas strategy is a behavioral pattern. 

Can you please provide a concise articulate response on what exactly is the biggest difference between these two methods? They seem very similar to me.

Main Difference

  • Factory/Abstract Factory: Focuses on creating objects and decouples client code from specific object classes.
  • Strategy: Focuses on selecting algorithms or behaviors depending on the situation without changing the client code.

I hope this helps clarify the main difference between these patterns!

БСрвис ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠΈ ΠΊΠ»ΠΈΠ΅Π½Ρ‚ΠΎΠ² Ρ€Π°Π±ΠΎΡ‚Π°Π΅Ρ‚ Π½Π° ΠΏΠ»Π°Ρ‚Ρ„ΠΎΡ€ΠΌΠ΅ UserEcho