Hacker News new | ask | show | jobs
by recursivecaveat 271 days ago
Usually when I have polymorphism I have some algorithm that operates on an array or graph of mixed instances of BaseClass. For any particular graph I know statically which concrete nodes I want and their arrangement. Factory really only made sense to me if you want to delay the actual creation of the array members, if the decision comes from something external, or if their creation is deeply entangled with their environment in a way you couldn't otherwise avoid repeating.
1 comments

Fair, that makes sense.