I don't think you need to worry. The object is not being recreated everytime.
Java (unlike C++ of course) should always pass pointers to such objects.
However you don't see this happening as it is all handled automatically and
there is no special syntax etc. If you think about it then you will realise
that as you can modify the original object from any of the methods to which you
passed it, all the references you have must point to the same place, hence you
only have one object !
If you had created a new object each time then this would not be the
case without some intermediate common class which updated a 'master object' I
pressume you do not have such a labryinth of code...
William
On Fri, 29 Oct 1999, you wrote:
> Hello all,
>
> On page 423 of Jason Hunter's book he says "Avoid the unnecessary creation
> of objects."
>
> Because OO programming is Java's paradigm, I have been assigning the
> parameter values to an object that represents the values in the request
> parameters. For example: I create an object that is GuestBook. After
> instantiating the GuestBook object as HTMLFormData, I then get the person's
> name for the guest book from the HTML file with the following:
>
> HTMLFormData.setName(req.getParameter("strName"));
>
> The advantage's are that I have my guest book record as an object and can
> pass the object to various method's with the object as a parameter (which is
> far easier than passing about 15 or 20 different parameters if the data from
> the HTML file were not an object).
>
> However, now I am begging to worry about memory, etc., especially after
> reading what Jason had to say on page 423.
>
> Any advice on the disadvantages to what I am doing would be greatly
> appreciated. And any advice as to what kind of OO programming to avoid in
> Servlets would be appreciated also.
>
> Brad.
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
--
The primary cause of failure in electrical appliances is an expired
warranty. Often, you can get an appliance running again simply by
changing the warranty expiration date with a 15/64-inch felt-tipped
marker.
-- Dave Barry, "The Taming of the Screw"
william:~#
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html