object (class) validation

  • Thread starter Thread starter Andy B.
  • Start date Start date
A

Andy B.

In some of my other posts I had (and am still working on) an Address object.
The Address would need to get values from a database in order to help
validate itself. Is it ok to have data access in the class in order to do
this? or should it be in a different spot?
 
Andy B. said:
In some of my other posts I had (and am still working on) an Address
object. The Address would need to get values from a database in order to
help validate itself. Is it ok to have data access in the class in order
to do this? or should it be in a different spot?

This really depends on the exact scenario.
 
In some of my other posts I had (and am still working on) an Address object.
The Address would need to get values from a database in order to help
validate itself. Is it ok to have data access in the class in order to do
this? or should it be in a different spot?

I think it depends on how general you want the Address object to be.
If it accesses the database, then it is tied very closely to your
database schema and can't be used with a different schema. That might
be OK or might not.
 
Jack Jackson said:
I think it depends on how general you want the Address object to be.
If it accesses the database, then it is tied very closely to your
database schema and can't be used with a different schema. That might
be OK or might not.

It's ok if the address object gets into the database. All of the "objects"
will be like this (at least the ones that need to be).
 
Back
Top