| A brief overview about the J2EE business services layer best practices and tools.
Business Services Layer Recommendations
- Use Session Facade,, Service Locator, Business Delegate and Transfer Object design patterns to provide a clear, layered architecture with well-known benefits. Refer to the J2EE pattern catalog for details.
- I always find it useful to seperate the non transactional and transactional beans into seperate layers. The transactional beans are the only ones that can be called from clients. If such a layering principle is used, it can be enforced easily with an AOP aspect. This can also help greatly in standardizing exception handling and logging at the transactional layer, ensuring that there is no duplicate logging.
- Clearly lay down and enforce exception handling and logging guidelines at the start of the project. These guidelines should cover an area beyond just the business layer.
Best practices in EJB Exception handling is a good article on the subject. Read/join the discussion about this article.
- Decide on how you want to handle sessions. If state-based thick EJB clients are going to connect to your business service, use stateful session beans. Otherwise, use web-based sessions. Even when thick clients are involved, my personal preference is to use web services and handle sessions at the web server layer. Your session handling decision have an important impact on your logging framework as you would always prefer to log session-based data when an exception occurs.
- Use code generation tools such as XDoclet to reduce mechanical (bug-prone) work of creating EJB interfaces, descriptors etc. and to improve business-layer code maintainability.
- Ensure that you have a clear and uniform strategy for searching and pagination type operations.
Reusable Frameworks/Tools
Some crucial services at the business layer should be implemented as part of the enterprise framework, considering current as well as future requirements. Some great open source options for many of these can be found at java-source.net. Some of these common services and links to resources are given below:
Go back to the Architecture Page
|
|