Layers in a Struts application
I am looking for comments/suggestions on appropriate layers and dependencies in a Strus application.
We currently have FormBeans, an Action layer, a Service layer, a Business logic layer, some Utilities, the Model objects, a Persistence layer and a Helper layer.
The Action layer is supposed to be kept very simple and call the service layer to actually do the real work. The Service layer should create and interact with Business objects as needed. We created the Helper layer because persisting some of the Business objects required writing to multiple tables. We allow passing FormBeans to the Service layer but use Model objects after that. The utilities should be generic so they can be used as needed.
If you allow validation on Struts FormBeans, that seems like business logic to me. In fact, we ran into a validation that required catching an exception and then we wanted logging there too. Also, we struggled with allowing FormBeans to be used throughout the layers. Otherwise, it seems like you are just marshalling data into and out of Model objects when the FormBeans would be just fine. Of course, you then kinda tie yourself to Struts.
The separation between Service layer and Business logic is fuzzy but without one it seems the actions would end up doing way too much.
We are trying to move to Hibernate and figure out where/when to use value objects generated by that.
Unfortunately, the dependencies were not enforced from the beginning of the project and it is easy to see with JDepend where we have classes depending on things they shouldn't. It can be extremely difficult to break some of the dependencies though.
It seems like we are headed in the right direction but I am interested in any feedback. Thanks

