I am going over the Article class and have questions about the instance methods.
The Delete method:
public bool Delete()
bool success = Article.DeleteArticle(this.ID);
this.ID = 0;
Why do we just set the ID property to zero and not reset all properties to their original values if the deletion is successful? Imagine that we have an Article object with all the information (holding the comments and everything) and we call the delete method. We would still have a lot of information in the object that is not really reflecting the record in the database. Is there a purpose for this?
The IncrementViewCount method:
public bool IncrementViewCount()
Why don't we update the object's ViewCount property? So we increment the ViewCount in the database by 1, but the property in the object is not reflecting that value. However, in the Approve method we do update the object's Approved property. This seems at least inconsistent.
The Rate method:
public bool Rate(int rating)
return Article.RateArticle(this.ID, rating);
Same thing as with the IncrementViewCount method. Why don't we update the TotalRating property?
Anyone else has found this awkward?
Thanks for any light on this.