gee Martin wrote:
Hey Folks,

I have a couple of questions (I'm curious to your opinion(s))

My opinions, then.
1. Is it advisable (under any circumstances) that Entity beans should have
business methods or behavior?
Methods yes, behavior probably not, if you mean the actual implementation of the business behavior.
E.g. (fictitious example) A Customer entity
bean which has a Email Contact dependent object. Should the Customer bean
have the behavior to use the Contact object the contact the customer?
Absolutely, though the behavior should probably be implemented in a dependant object (like Customer, as opposed to CustomerEntity).  Entity beans are facades to graphs of persistent domain objects.
2. Dependent objects. Is it OK for these objects have behavior or business
methods? E.g.
                         Customer
                               |
                              /  \
                           /        \
                 Contact      Address

Where Contact and Address are dependent objects (they live and die with the
customer entity). (IMHO These are pseudo entity beans since they represent
database tables)

IMNSHO entity beans do not represent database tables, they are coarse-grained components.  They serve as facades to graphs of persistent, fine-grained, dependant domain objects.
Is it OK for the Customer entity to have a business method
which exercises behavior in the Contact Object (contact a Customer)?
Yes, though the implementation of the business behavior should be delegated to a fine-grained domain object.  I would have a class called CustomerEntity, which implements the bean logic and serves as a facade to the domain class Customer, as well as all of its dependant objects, such as Contact and Address.
TIA,
Martin
There are numerous discussions of these topics in the archives.  I also had an article published in the 8/99 issue of Component Strategies where I discussed my point of view on these questions.
begin:vcard
n:Wilson;Chip
tel;fax:(214) 358-0353
tel;work:(214) 642-4559
x-mozilla-html:TRUE
url:http://www.axyssolutions.com/
org:Axys Solutions
adr:;;;Dallas;TX;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:Application Architect
note:Sun Certified Java Architect
x-mozilla-cpt:;-25088
fn:Chip Wilson
end:vcard

Reply via email to