Skip to main content
10 events
when toggle format what by license comment
Aug 13, 2014 at 15:37 vote accept Patrick Collins
Dec 26, 2013 at 5:28 comment added RibaldEddie Are there any special steps your code needs to do to the Post object between the API call and returning the populated Post? If not, then just put the code in the repository. If so then rename your Factory to be a Builder. Look up the builder pattern.
Dec 26, 2013 at 5:25 comment added Patrick Collins @RibaldEddie: it's the opposite. Post objects contain data that's been scraped from another site. They get passed an ID to look up, then pull down information about it from an API.
Dec 26, 2013 at 5:16 comment added RibaldEddie More or less, that's right. But I do wonder what's up with your system. Why is creating an object requiring creating a database record? Or when you say "create a post object" do you mean something like "save a post object or persist a post?"
Dec 26, 2013 at 5:07 comment added Patrick Collins @RibaldEddie: Yes, that was my intention. Does it not qualify because it only produces objects of one type? I originally had Post objects get passed a connection to the database and then pull the necessary info, but it seemed messy because posts have nothing to do with database connections. I thought that the thing that made Post objects should be a PostFactory, do you think that could be confusing because it's too limited? Is there a more reasonable name for "the class whose instances are used to create Post objects"?
Dec 26, 2013 at 4:21 vote accept Patrick Collins
Dec 26, 2013 at 4:55
Dec 25, 2013 at 18:50 comment added RibaldEddie If you're using the word "Factory" to refer to an implementation of the Factory OOP design pattern, you might want to rename your class. Object oriented factory pattern isn't what you're doing. See Robert Harvey's answer.
Dec 25, 2013 at 18:14 answer added Hopeful Llama timeline score: 1
Dec 25, 2013 at 16:56 answer added Robert Harvey timeline score: 12
Dec 25, 2013 at 16:21 history asked Patrick Collins CC BY-SA 3.0