I know about Simple Factory Idiom, Factory Method and Abstract Factory Design patterns.
But I have two situations that I'm not sure how to call (PHP code example) :
class User {
public static function LoadUserById($id) {
$objUser = new User();
//load details from DB
return $objUser;
}
}
class UserFactory {
public function Create($id) {
$objUser = new User();
//load details from DB
return $objUser;
}
}
What are these two situations? Simple Factories (programming idiom) or are they called something else?
Is a good practice to name the class UserFactory? Isn't this something that might get confused with the A factory design pattern? Should I use different name for it like UserFinder?
When I think of the Factory Design Pattern I always think of examples where there are families of components derived from a parent class but it is clearly not the case here.