I've always hated checked exceptions and always preferred using RuntimeExceptions. I usually find that I rarely have the ability in my code to recover from a particular exception thrown by a particular method and adding a checked exception to the throws clause would just require ugly try/catch blocks for my users.
There are occasions though in some methods, I still want to throw a RuntimeException, but want to make it known to users that it is possible to recover from a particular exception. At first, putting these exceptions in JavaDoc seemed like the best idea, but, what if I want to catch a particular exception? I have to look in the JavaDoc to see what runtime exceptions are thrown. I also can't ask my IDE to automatically create a typed try/catch block for me. So...What about declaring RuntimeExceptions in the throws clause? Is this a good convention?
Maybe this is an old practice, maybe not. I first came across this idea of putting RuntimeException exceptions in the throws clause during the EJB 3.0 expert group when all EntityManager exceptions are RuntimeExceptions but there were a few cases where it would be interesting to catch an exception thrown from an EntityManager method. Again, since the RuntimeException would be available in the throws clause, an IDE could automatically generate the try/catch block for me when coding. Is this a good idea or not? Let me know.
Due to our first blog about JBoss EJB 3.0 successes and the fact that TSS picked up that blog, the success stories are starting to pile in. This particular testimonial is from Ron Hatcher of the Millfield Group in the UK. Look for more testimonials to pop up here in the next few weeks. If you have your own EJB 3.0 testimonial, please firstname.lastname@example.org
The Millfield Group plc. is a financial services company with over 1500 advisers, including independent financial advisers, independent mortgage advisers and other specialist advisers in our regional offices throughout the UK. We have adopted JBoss as our strategic platform for enterprise development and have now begun releasing EJB3 based applications into production.
Our recent EJB3 implementation is the first application to take advantage of our evolving service delivery platform - Jupiter. It is based on a three tier physical architecture with Windows/IIS web servers, Solaris/JBoss application servers, and Windows SQLServer database servers. This structure is quite common (and has been for some time). The difference now is the effectiveness that the JBoss EJB3 implementation brings to the whole development process.
Our Jupiter platform provides a core set of services and business objects that are generic across our business domain. These services and objects are then used by applications that 'orbit' around it. Currently these applications invoke the core services by accessing stateless session beans, but these will expand to include web-services and Message Driven Beans in the future.
The first application - Leda - is a mortgage referrals system. Estate agents use it to refer their home buying clients to mortgage selling financial advisors. We use the Front Controller/Dispatcher mechanism to manage the presentation tier, and use a single dispatcher for each use case in the system (there are approximately 12). Our initial user group has been restricted to 250, however we are planning to bring an additional 750 users online in the very near future.
While building the application, I was very pleased with the ease of implementation of the entity model. Although we have built hibernate based applications in the past, the EJB3 entity beans really take all the headaches away from the persistence mechanism.
We did encounter a few issues during the initial build -
There has been much written recently about EJB3 persistence, annotations, and dependancy injection from an implementation perspective, but I feel the real benefit here is in the whole development file-cycle. In the EJB2.1 world, we adopted the many of the Sun Architectural patterns to get the performance and usability we required from the platform, but these mechanisms required a translation from the business requirements and business model to the implementation. Our current development aims to solve this problem by using JBoss Jbpm.
As a financial services company, we are required to implement and use many regulatory processes. These can be quite complex, and code to implement them quickly becomes complex and hard to maintain.
Our first regulatory application - Callisto - uses Jbpm to manage the business process, and invoke our EJB services as required. This allows for the implementation code to be narrowly focused on a specific step in the business use case, and moves any process related code out of the equation. Using this technique, we effectively automate our business process with very little interpretation between the business spec and the final implementation.
Our initial testing has shown this approach to be extremely effective in quickly building applications, and keeping the code very clean and maintainable. Again, we experienced a few issues so far with Jbpm.
All in all, I am very pleased with our success to date using EJB3 and Jbpm, and am confident that this will support our platform development efforts for some time to come. Our current plans involve implementing two more modules in the next 12 months, and expanding the user-base of the platform to 10,000. I would like to take this opportunity to thank all of the JBoss contributors for providing a great environment, and also to our EJB developers Richard King, David Oliver, and Victoria Weston.