class factory pattern question

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

I've seen design patterns for class factories that work well to create
(fetch) objects, but I haven't seen anything about how to persist the class'
data when it has changed. Is this done thru the factory? What about
security? I'm assuming that the factory should enforce security.

Has anyone seen examples of this?

Thanks,

Craig Buchanan
 
Can you give me an example of what you mean by persisting data when its
changed? As in notifying the underlying data storage? Or other objects
within the program that need to know when data is changed?

-CJ
 
CJ-

Thanks for the reply.

I was referring to persisting data in the database. It doesn't seem like
the factory should be doing this, but I could be wrong. Currently, I use
the base object's (named ObjectInfo) Save method to persist information. I
have a blob field that contains a serialized collection of properties for
its decendant's properties

Here's what I want to do:
* Build a factory that will create a new ObjectInfo instance or an
instance of one of its decendants.
* The factory will return a collection of ObjectInfos that match given
criteria and the security clearance of the user.

Thoughts?

Craig
 
Craig,

That was going to be what I recommended was using the base object to do the
save. The factory isn't really responsible for that from what I remember
about the pattern, just the creation of the object with a common interface
(or base class) then the object itself took care of persistance, but that
was dealt with in the base class.

I suppose you could use the factory if you wanted to, but seems a little out
of the way you know? Unless you want the factory to deal with your BLOB
data.

But I don't know if thats necessarily needed.

HTH,
CJ
 
Back
Top