Original Post
Ok. I've got both the GoF pattern book and Head First Design Patterns in front of me, but I'm having trouble fully understanding any of the Factory Patterns (Factory, Abstract Factory, Factory Method). Currently I'm working on a space invaders type space shooter. The main Entity in my game is <>Ship, which has 2 subclasses: PlayerShip and <>EnemyShip. Now the EnemyShip has several subclasses, all of which are the individual types of enemies (i.e. AggressiveEnemy, DefensiveEnemy, KamikazeEnemy, etc). Also, everything is hard-coded, there's no XML or file loading/reading going on. So, ignoring any knowledge of the Factory Pattern/s, I would imagine that I could have a Factory to produce my EnemyShips. Now, taking the patterns in account, I can't figure out how I could use a Factory for my ships. From what I understand, when a call is made to the Factory to produce an EnemyShip, the Factory needs to know what EnemyShip to produce. Here's where the pattern loses me. If the Factory needs to know what to produce, what's the point in delegating the task of creating that specific EnemyShip to the Factory, when you could just explicitly create a new EnemyShip of that specific type?