Hey Folks,My opinions, then.I have a couple of questions (I'm curious to your opinion(s))
1. Is it advisable (under any circumstances) that Entity beans should haveMethods yes, behavior probably not, if you mean the actual implementation of the business behavior.
business methods or behavior?
E.g. (fictitious example) A Customer entityAbsolutely, 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.
bean which has a Email Contact dependent object. Should the Customer bean
have the behavior to use the Contact object the contact the customer?
2. Dependent objects. Is it OK for these objects have behavior or businessIMNSHO 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.
methods? E.g.
Customer
|
/ \
/ \
Contact AddressWhere 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)
Is it OK for the Customer entity to have a business methodYes, 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.
which exercises behavior in the Contact Object (contact a Customer)?
TIA,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.
Martin
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
