Craig,

"On the other hand, if there is a "one-to-many" relationship (in your case,
one employee with multiple payments), I would make two different beans --
Employee and EmployeePayment -- and then store one employee bean and as many
payment beans as I needed to."

How about an employee bean that has an empty Vector of payments as an
attribute. Is there a downside to doing it that way, so that all employee
info can be encapsulated together and neatly stored or retrieved from the
session?

Bill Hines, Hershey Foods

-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 22, 2000 7:44 PM
To: [EMAIL PROTECTED]
Subject: Re: A design question

Louis wrote:

> Hi,
>     I use model 2 in my web application.  I have a question about design a
> bean.
> I'm not sure whether I want to create a big bean or many small bean.  For
> example,
> I can create a bean that contain employee personal info, and another bean
> that contain
> employee payments, etc.  Or, create only one bean that contain all the
info.
>     Is there any different btw this?  Can anyone tell me which method is
> good?  Passing the big bean, will it be slow down the performance? or use
> more memory?
>

Since the beans all stay in the server's memory, there isn't really much
performance difference between one big bean and two small ones.  You should
design
your beans based on object oriented design principles, rather than worrying
about
performance.

The "rule of thumb" that I use is if all the information is about one thing
(like
an employee in your case), *and* there is only one copy of all the fields, I
make
it all one bean.  On the other hand, if there is a "one-to-many"
relationship (in
your case, one employee with multiple payments), I would make two different
beans
-- Employee and EmployeePayment -- and then store one employee bean and as
many
payment beans as I needed to.

>
> Sorry my english, hope you can understand.
>
> Louis

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to