mercredi 22 novembre 2017

Static function to get a user list

I have a need to list the users in my database, but being unfamiliar with OOP best practices I am unsure where to implement the method. So far I have come up with two choices:

  • Using my existing User class, create a static method to get users User.GetAllUsers().
  • Create a factory object to create a static method UserFactory.GetAllUsers()

My question is really is there a best way to do this, and is there any performance differences. Or is this down to application / programmer choice.

Aucun commentaire:

Enregistrer un commentaire