Here's what Brett has to say on the subject (briefly):
 
"...While stateful beans can be helpful for processes or tasks that span multiple requests, they are often slower and obviously require more memory in the virtual machine.  Stateless session beans, though, are very fast, and often only a few instances are needed to serve hundreds of requests.  These qualities make them ideal for most business tasks, and preferable for better application performance.
 
"...First, unless there is a reason not (emphasis in original) to use stateless session beans, you should use them.  Using stateless beans over stateful ones in the general case can drastically increase application performance.  Because the EJB container can share stateless session bean instances across all EJB clients, it can maximize performance, as well as cache the instances in some cases.
 
"...Finally,...(A)lthough the bean doesn't persist across requests, it can be used multiple times over one request and bean lookup.  For this reason, multiple methods that operate on the same logical data can be consolidated into a single bean.  This can really clean up code and clarify what different components are used for.
 
"...I've emphasized this quite a bit, but I'll say once more that you don't want to use stateful session beans for many of [your] business processes...."
 
Java Enterprise Applications, Volume I: Architecture, pp. 22-23.
 
Further, Sasha Nikolic doesn't even discuss stateful session beans, recommending that for most uses, a session façade using stateless session beans or a singleton cache (possible using a HashMap) are the preferred methodologies.
 
Java Enterprise Best Practices (O'Reilly 2003): 7-31, esp., 10-13 and 22-24.
 
As for Brett's experience, he's "been working in computers since the Logo days.... He has spent the last several years implementing [Java-based application infrastructures] at Nextel Communications and Allegiance Telecom, Inc.  Brett is one of the cofounders of the Java Apache project Turbine....  He is also a contributor to the EJBoss project...and Cocoon....  His projects all focus on using XML and the J2EE platform in mission-critical, high-performance, distributed systems.  Together with Jason Hunter, he has defined the JDOM API....
 
Java Enterprise Best Practices (O'Reilly 2003): Chapter 5 and p. 266.
 
Brett also defined the Struts framework and is presently lead architect for the Apache Tomcat project.
 
 
Mark
 
 
-----Original Message-----
From: Victor Langelo
Sent: Tuesday, December 09, 2003 12:15 PM

Well, I've never read Brett McLaughlin's book. I doubt I'll go out and buy it based on what you've told me so far. What exactly is his reasoning for saying stateful session beans are so heavy that you need to avoid them in cases where they are perfectly appropriate?

Based on Mr. McLaughlin's resume, I've been designing/coding applications a lot longer. Unfortunately too many people pay far too much attention to a person's credentials instead of reasoned arguments backed up by actual experiments. Does Mr. Laughlin's book include actual test cases which demonstrate his point?
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to