[thelist] OOD question

Scott Dexter dexilalolai at yahoo.com
Thu Oct 7 16:17:30 CDT 2004


--- Steve Lewis <nepolon at worlddomination.net> wrote:

> Scott Dexter wrote:
> 
> > class User : DataAccess
> Sounds like bad naming more than anything else.  What is a
> DataAccess 
> object like anyway, in this case?  Maybe DataAccess should be
> Record? 

In this case DataAccess has all the CRUD[1] functions, and User is
wired to use them directly; a wrapper class doing User-specific
operations, i.e.

public class User : DataAccess
{
...

public string UpdateUser(object updateThis)
{
  User agent = (User)updateThis;
  StringBuilder sb = new StringBuilder();
  ...
  // call to DataAccess.updateSQL
  this.updateSQL(sb.ToString());
  return sb.ToString();
}
...
}
So it appears (to me) that the usage here is for encapsulation only,
not inheritance. Which begs the question, why use inheritance instead
of some other pattern to accomplish this?


Exploring this for academic's sake,



[1] CRUD = CReate, Update, Delete. Basically, the same old Insert,
update, delete database operations you use all the time.


More information about the thelist mailing list