There is no hard and fast rule for OO Design, it is an ART.
Too much OO is bad too... for example in the case of Object-Relational
Database Design, your application will not scale up if there is too much
overhead in the creation of objects with complex relationship.
That are normally a few objectives when you design your applications, and
you have to prioritise you objectives:
For example your objectives may be
a. Management of Complexity;
b. Ease of Developement;
c. Extensibility;
d. Performance.
e. Last but not least, Time to Market.
Now bear all this in mind when you design your applications and always write
down the rational of your decision based on the objectives so thta you do
not have to revisit it again.
Based on your question, I would prioritise objective (a) and (c) as of
higher priority and hence build the application based on what you have
designed (i.e. HTMLFormData as an object)
Performance is a tricky issue that you need to test it based on some
reasonable assumptions.
I strongly propose that you read the book "Refactoring" by Martin Fowler as
a guide for OO design, it is a very good book which can be used as a
checklist for design and code review.
Regards.
Tan Teck Seng
-----Original Message-----
From: Simonin, Bradley <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Saturday, October 30, 1999 10:07 AM
Subject: Object Oriented programming in Servlets....
>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
>
___________________________________________________________________________
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