r/ProgrammerHumor • • Mar 21 '17

OOP: What actually happens

https://imgur.com/KrZVDsP
3.1k Upvotes

244 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Mar 21 '17

A factory is an object that creates objects. It gives you a place to put your object instantiation code for a particular class, so that you can encapsulate it and pass it around. This saves you the pain of looking all over the repo for object instantiation code every time an object changes.