wood burning stoves 2.0*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Business Layer Design in J2ee Poject Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Business Layer Design in J2ee Poject" Watch "Business Layer Design in J2ee Poject" New topic
Author

Business Layer Design in J2ee Poject

amit gole
Greenhorn

Joined: Aug 31, 2012
Posts: 1
Hi to all members,

Currently the project on which I am working on a j2ee project which is being developed with Spring, Hibernate and struts. The business layer consists of simple java beans with no behavior in them only properties with getter and setter methods.The services in business layer acts on these simple java beans like populate them from data access data and then return to presentation tier.My questions is that is it object oriented way of designing business layer or simply the procedure way in which the data and the functions on which they operate are not together. Please provide your thoughts and inputs on how the business logic is designed and implemented in j2ee application, is the domain model just contains simple objects with no business methods in it and services are written on these java beans which implements the business logic.
whats are the design patterns used in the development of business layer.

Thanks And Regards
Amit

Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4777
    
    8

Data-only domain objects are smelly. It doesn't mean they're necessarily wrong but it's an indication that maybe your business service classes might be overstepping their bounds. There are no cut and dry rules for this kind of thing though, as far as I can tell. I use testing to help me find bad choices. When it's hard to test some behavior because of too much setup or too much coupling, then I know it's probably time to refactor. I can't think of a good example off the top of my head but I know I've encountered situations where I've moved logic from a business service class back into a domain object after detecting the "data only domain object" smell. The rule of thumb I use: Business Services coordinate work between different objects. Domain objects keep track of the integrity of its relationships with other objects. Another guideline I use that helps with properly assigning responsibilities: Define the transaction boundaries at the business service level, not at the domain object level.

Hope this helps.


Junilu - [How to Ask Questions] [How to Answer Questions]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4777
    
    8

... and Welcome to the Ranch!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Business Layer Design in J2ee Poject