Kevin,
Our performance engineers have done some benchmarks on jdk 1.3 and have
basically declared the difference insignificant... now it probably goes
without saying that you wouldn't want to do everything with reflection, but
a little in the right places is certainly a good thing -

Margaret

-----Original Message-----
From: Kevin McLain [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 5:33 PM
To: [EMAIL PROTECTED]
Subject: Reflection vs. Direct Method Call


Hello All,

Just a general performance question....

Does anyone know the performance difference between a direct method call and
introspection like Struts uses? I would be interested in hearing the
differences for different Java implementations (I have heard that JDK 1.4
will be making huge improvements in this area) because I have heard that
there can be significant differences. The application I am considering using
Struts with would require large amounts of numerical data to be posted
through the introspection and therefore if introspection performance is a
problem I would have to choose another framework or roll my own.

Thanks for any help,

Kevin

-----Original Message-----
From: Andreas Amundin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 2:50 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Use of form beans - design issue...


First let me preface with the fact that I have been dabbling with struts for
about 6 weeks, so please take what I say with a grain of salt.  And anyone
else out there please correct me if I am wrong.

See my inserted replies below.

> From: Burleson, Thomas [mailto:[EMAIL PROTECTED]]
<snip>
> Currently -- as I understand it -- the ActionForm (bean) is
> populated by the ActionServlet using introspection. And the
> Bean is then used by the Action (handler) to modify/update
> the business
> layer or model data. Then the actionForward is used to
> indicate which JSP the Servlet should forward/dispatch to.
> The page (which could be a different JSP page or the same
> used for the request) then searches for the ActionForm (bean)
> and creates one if it does not exist in the request scope.

This is where my understanding differs.  As I understand it the ActionForm
is created by the JSP if none exists.  As far as I know it is possible to
directly load a JSP page with a form without invoking any pre-processing
action servlet.

> So (finally) here is the issue:
> The controller and handler uses a "dumb" bean to modify the
> model (MVC). Cool!
> But to gather information for use on a JSP, the bean must
> know how to gather that data from
> the business layer (model). BAD!!

Following your understanding of how things work I completely agree with what
you are writing above.

However, let me now state that I don't think beans used in a JSP should ever
have any dependencies on the model.  IMHO beans for use in JSPs should be
dumb holders of information.  They are the input and output parameters of
the JSP.  To populate beans for a JSP a pre-processing action servlet should
use model classes or EJB entity beans.  The action servlet controls how
information from the model is propagated to the view.

> The handler should configure the bean BEFORE dispatching to
> the JSP. This way, the bean remains
> "dumb" and the handler centralizes all knowledge of the
> business layer.

Exactly.

> Struts seems to use 2 different patterns/approaches: the
> incoming processing is very different than the processing
> used during display of the JSP.

I would say Struts have an approach for incoming, from the form, processing
that automatically populates the form bean with the information from the
form.

For the processing during the display of a JSP all that happens is that the
form bean is created if one cannot be found.  The found form bean, newly
created or not, is used to populate the default values of the form.

I hope this explanation makes sense.

Andreas

Reply via email to