--- Mike Bresnahan <mike at fruitioninc.com> wrote:
> > Also, what is written so far doesn't actually do much except wrap
> the
> > ends of a Queue with wait/notify.  You still have to make some
> threads,
> > do something useful with the thingy, and start the execution.  Not
> to
> > mention deciding where to put the looping (parent Thread with a
> > separate run() or in the run() s above) and how to control the
> > termination of the process.  Once you decide where to put these
> things,
> > ask yourself how obvious will your decision be to the future
> > maintainers?
> 
> But that is one reason why one uses a pattern - so that others can
> more
> easily understand what you are doing and why.  Any reader versed in
> the
> producer-consumer pattern will immediately have a good sense of the
> hows and
> whys simply by seeing the name "producer-consumer".  Contrary to
> this,
> rolling your own solution causes the reader to start with nothing. 
> No?
> 
> I see patterns as a way to attack complexity not a way to increase
> it.
> 
> Mike
> 
> 

I agree with this somewhat, but I will still stick to my guns about the
'be careful not to over-use patters' issue.

The naming of patterns does tend to give people a cognitive anchor for
dealing more easily with the over-all problem.

But you can get most of that benefit just by giving your classes and
variables good names.  For instance, who would possibly be confused by
a LinkedList called cyberCacheTransactionQueue?  Or a method called
startTransactionProcessingThreads( LinkedList inputQueue )?

If you are getting the same thing done, and in much the same manner
(start a bunch of threads, feed a queue from elsewhere, have the
threads crunch away at the queue), then why put an artificial
constraint on what classes to use?  Particularly if most of the
functionality you need is already sitting in front of you.

There's no reason that a single class can't do both the producing and
consuming, but if you are dead set on <holy_music>Implementing A
Pattern Based Solution</holy_music>, that simply won't be something you
will think of.

All I'm saying about patterns is that they are not a silver bullet.  

Be careful out there.

Bill


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/