[thelist] OOD question

David Mitchell dave at dbmdata.com
Thu Oct 7 15:03:46 CDT 2004


Yes, it is sorta fishy from an OO standpoint. A class should subclass
another one when the objects are related and you want to extend the
functionality of the base class. 

To demonstrate what I mean by related, say you have a base class called
"Person". A person has common attributes no matter if that person is an
employee or customer such as FirstName and LastName. However, employees and
customers may have particular attributes that are specific to those types,
for example, and employee may have an employee number, a customer may have
prime contact. SO, you would have base class of Person, and two subclasses
of Employee and Customer.

To address the data access components, a common pattern we use is to have
static methods in a DBUtil class that returns the necessary objects (ie: a
static method that called GetConnection that returns a SqlConnection, etc.).


Dave



More information about the thelist mailing list