----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Generally, spliting your functionality into multiple classes allows better
optimization and decreases the time required to maintain the code.  In the
first iteration, a system done well with this paradigm will be slightly
(but not by more than a small percentage in most applications) slower than
one which is built as a single monolithic entity. 

However, after a few revisions, the equation shifts dramatically --
because so much time is required to simply maintain the monolithic code,
and so much effort is required to make any changes without breaking
everything else.  Inefficienct algorithms -- which were not a problem
initially, but become so later on -- are harder to fix; new features which
are added can be done so only in inefficient (or sub-optimal) ways; etc.

This is not to say that OO design (whether or not it's done with an OO
language like Java) is guaranteed to save you time, or to make your code
more maintainable, or any such thing.  However, good OO practicies,
combined with good use of other patterns when appropriate, will help.

And in some cases, it's better to simply build something quickly rather
than worrying about maintenance.  If it'll take less time to build from
scratch for each iteration than to adjust your previous one, then that
logic applies; and if you take this approach, monolithic code may not be a
problem, because it'll be built in a small period of time, sufficiently
small that you'll be able to keep all the details in mind while working. 

So far as servlets go -- I wouldn't use chaining.  I'd work with a
templating system (GSP or JSP, probably) and put the core logic behind the
presentation layer, in objects (but not servlets) to which the templates
had access, one way or another.  Even if you don't want to use a
templating system, there are big advantages to putting the core logic in
classes which are separated (at least slightly) from the presentation
layer servlets.

hth --

Ed

On Mon, 21 Feb 2000, SeJo wrote:

> This may be off topic but I'd like to know how is splitting funcionality
> accross servlets going to improve the speed of service() in general?
> I am really curious to find out what are REAL advantages of servlet
> splitting, chaining etc........good software engineering and reusability are
> fine but in most of the cases I simply want it fast and thats it .........
> 

--
See you at ApacheCon 2000 in Orlanda, Florida, March 8-10, 2000.
                 http://www.Apachecon.com/



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to