TEMPLATE! METHOD!  TEMPLATE!  METHOD!  TEMPLATE METHOD!  Scheesch!  Help!

The RequestProcessor is NOT difficult to understand.  It is a java
CLASS, neither an abstract class nor an interface, which has one
principal public method, viz. process(...) which involves a lot of
code which is further broken down into parts delivered seriatim by
eighteen protected methods.  There are also three protected supporting
methods and two public methods for initialization (init(...)) and
destruction (destroy()).  The "structure" of the class, with the
processing in the process(...) method is "shown" below.

The RequestProcessor does not "define" methods at all.  It is not a
template at all.  There are NO TEMPLATE METHODs.  The RequestProcessor
is not an abstract class or an interface.  It is just a class with a
series of utility methods that breakdown a single method.  That's it. 
If we think that the RequestProcessor is an instance of the Template
Method pattern, then we cannot have meaningful discussions on the use
of patterns in Struts at all.  ISometimes you just have to say that
the king has no clothes.  This is absurd.  Why not say that the
RequestProcessor is an instance of both the Template Method pattern
and the Strategy pattern?  That would mean nothing makes sense in this
discussion any more.  If the point of this discussion is just pride,
then I bow out.  If it is patterns, then I don't know how to talk to
someone who thinks that the RequestProcessor is an instance of the
Template Method.

Sometimes we get the lyrics, or part of the lyrics, and miss the tune
and the rest of the lyrics completely.  Reminds me of a friend in
school that thought a tune we heard in a honky tonk bar about "flying
high" was an airplane tune.  Okay dokay!

--  We are either here or somewhere else.
--  We are either in Washington D.C or somewhere else.
--  We are not in Washington D.C. so we must be somewhere else.
--  We are somewhere else, 
--  Ergo, we are not here.

public class RequestProcessor {
  public void destroy();
  public void init(....);
  public void process(HttpServletRequest request,
                               HttpServletResponse response) 
        throws IOException, ServletException {
    request = processMultipart(request);
    String path = processPath(request, response);
    processLocale(request, response);
    processContent(request, response);
    processNoCache(request, response);
    processCachedMessages(request, response);
    ActionMapping mapping = processMapping(request, response, path);
    ActionForm form = processActionForm(request, response, mapping);
    processPopulate(request, response, form, mapping);
    Action action = processActionCreate(request, response, mapping);
    ActionForward forward = processActionPerform(request, response,
action, form, mapping);
    processForwardConfig(request, response, forward);
  }

  // ----------------------------------------------------- Processing Methods

  protected Action processActionCreate(...)
  protected ActionForm processActionForm(...)
  protected void processForwardConfig(...)
  protected ActionForward processActionPerform
  protected void processCachedMessages(...)
  protected void processContent(...)
  protected ActionForward processException(...)
  protected boolean processForward(...)
  protected boolean processInclude(...)
  protected void processLocale(...)
  protected ActionMapping processMapping(...)
  protected HttpServletRequest processMultipart(...)
  protected void processNoCache(...)
  protected String processPath(...)
  protected void processPopulate(...)
  protected boolean processPreprocess(...)
  protected boolean processRoles(...)
  protected boolean processValidate(...)
  protected void internalModuleRelativeForward(...)
  protected void internalModuleRelativeInclude(...)
  protected void doForward(...)
  protected void doInclude(...)
  
  // -------------------------------------------------------- Support Methods

  protected MessageResources getInternal(...)
  protected ServletContext getServletContext(...)
  protected void log(...)
  protected void log(...)
}







Isn't logic wonderful.  I love you, Peter, but am absolutely amazed
you could say that the RequestProcessor is at all an instance of the
Template Method much less a "sure fire" instance.  This whole
discussion has been very revealing to me.








On Wed, 9 Mar 2005 12:46:15 -0000, Pilgrim, Peter
<[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > From: Dakota Jack [mailto:[EMAIL PROTECTED]
> >
> ==////==
> 
> > I have no idea why Craig would say that the RequestProcessor is
> > somehow related to the Template Method pattern.  It just isn't.
> >
> ==////==
> 
> Ithink that the request processor defines a set of method to
> process an arbitary HTTP request from a HTTP client and
> generate a HTTP response.
> 
> "[The template method] defines the skeleton of an algorithm
> in an operation, deferring some steps to subclasses."
> 
> "The template method fixes the names and [potentially]
> the order of the operations, but allows subclasses to
> vary those steps as needed."
> 
> A sure fire description of the ``TilesRequestProcessor'' if I
> ever saw one.
> 
> --
> Peter Pilgrim
> Operations/IT - Credit Suisse First Boston,
> Floor 15, 5 Canada Square, London E14 4QJ, United Kingdom
> Tel: +44-(0)207-883-4497
> 
> ==============================================================================
> This message is for the sole use of the intended recipient. If you received
> this message in error please delete it and notify us. If this message was
> misdirected, CSFB does not waive any confidentiality or privilege. CSFB
> retains and monitors electronic communications sent through its network.
> Instructions transmitted over this system are not binding on CSFB until they
> are confirmed by us. Message transmission is not guaranteed to be secure.
> ==============================================================================
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to