Hacker News new | past | comments | ask | show | jobs | submit login

Yes, if you determine that creating your objects requires passing in state or using some logic that you don't want to put in the constructor, then using a factory or factory function makes sense. However that has nothing to do with creating a dynamic number of enemies.

Object pooling is a good point actually.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: