I'm starting to work with oop to build a site of user generated data.
There are different types of data coming from my classes. I have functions that get a list of data from the database, and functions to just select one item from those lists. For example
function Get_Article($aid); //Gets an article
function Get_Users_Articles($uid); //Gets a multidemsional array of the users
//articles
function Get_Latest_Articles(); //Self explanatory by now
function Get_Local_Articles($zip); //Gets articles written by local users
function Get_Local_Users($zip); //Gets all local users
function Get_All_Article_Comments($aid); //Gets a multidimensional array of the
//comments written for an article
function Get_Article_Comment($cid); //Gets a single article comment
Now, how should I set up my classes to organize these functions. Should I just put them all in the same class, or should I seperate the comments from the articles, or maybe seperate the functions that retrieve a single article/comment from those that retrieve a list of articles/comments. I might add more things to the site later that allow for comments, so I was thinking of just seperating all the comment functions from the others. Also, the "local" functions all use the same function that performs the math, so should I group those together, or maybe just use inheritance... any suggestion???
While on the subject of oop, I have a user class that looks like... private $user = array();
public function Get_User_Data($uid){
//get user data from database
return $this->user;
}
public function Set_User_Data($user_array){
$this->user = $user_array;
}
public function Add_User(){
//INSERT data from $this->user into the database
}
Now does anybody see anything wrong with the way this looks, mostly, should I set the user_data as a parameter for the Add_User function, instead of inserting the member variables?