ok, i think - of the options you present I like C best (performance
considerations and all).

I don't want to potentially have to hit the db for each Certified
Worker so one call seems to be the best bet


The only thing I'm not too sure about is the fact that it is in the
workerDAO - isn't there some object defination that is already
supposed to handle deletion from multiple rows at one time.  Is a
Gateway really limited to only selecting multiple rows?

I guess I wouldn't mind adding this one "extra" method to the
workerDAO - but that starts a slippery slope that I would prefer not
travelling down.

For instance if worker not only has optional Certifcates but
ProbationType and SupervisorID


or to think in terms we might all be more familiar with 

an  Defect might have a Milestone (or not) a Category (or not) a
Priority (or not) and an Area (or Not).

Milestones and Areas might both be deletable and thus need the same
treatment as Certification does with Worker in the prior example.  Now
I suddenly have to have two "wierd" queries in my DefectDAO

thanks again,
Bill



Bill


On Wed, 26 Jan 2005 09:49:24 -0500, Patrick McElhaney
<[EMAIL PROTECTED]> wrote:
> I hacked together some psuedocode based on the certificate example.
> (The same logic would apply to students and del.icio.us tags.)
> 
> --- Example A ---
> [TrainingService]
> removeCertificate(id) {
>   workers = workerDAO.getWorkers()
>   for each worker in workers {
>      worker.removeCertificate(id)
>   }
>   workerDAO.store(workers);
>   certificateDAO.delete(id);
> }
> ------------------------------
> 
> I might make a small compromise for performance.
> 
> --- Example B ---
> [TrainingService]
> removeCertificate(id) {
>   workers = workerDAO.getWorkersWithCertificate(id)
>   for each worker in workers {
>      worker.removeCertificate(id);
>   }
>   workerDAO.store(workers);
>   certificateDAO.delete(id);
> }
> ------------------------------
> 
> Or a big compromise.
> 
> --- Example C ---
> [TrainingService]
> removeCertificate(id) {
>   workers = workerDAO.removeCertificateFromWorkers(id);
>   certificateDAO.delete(id);
> }
> ------------------------------
> 
> But I wouldn't do this.
> 
> --- Example D ---
> [TrainingService]
> removeCertificate(id) {
>   certificateDAO.delete(id);
> }
> 
> [CertificateDAO]
> delete(id) {
>   workerDAO.removeCertificateFromWorkers(id);
>   ...
> }
> ------------------------------
> 
> The thing I don't like about example D is that I can't tell from
> looking at TrainingService.removeCertificate() that a certificate is
> removed from all of the workers before the certificate itself is
> deleted.
> 
> Also, while workers depend on certificates (they're "certifiable")
> certificates probably don't depend on workers. CertificateDAO probably
> shouldn't know about workers or WorkerDAO.
> 
> Patrick
> 
> --
> Patrick McElhaney
> 704.560.9117
> http://pmcelhaney.blogspot.com
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[email protected]
> 


-- 
[EMAIL PROTECTED]
http://blog.rawlinson.us

I have 9 gmail invites,want one?
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to