When to use Factory method pattern?
Use a factory method (not abstract factory) when you want to reuse common functionality with different components. Example: Imagine you have an M16 rifle. Something like this: public class M16 { private Scope scope = new StandardScope(); private SecondaryWeapon secondary = new Bayonet(); private Camouflage camo = new DesertCamo(); public double getMass() { // Add … Read more