This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I've been struggling with a proper way to get my controller to talk to my service layer. It's not that I can't get the two to talk, it's that I want to make sure that there are no dependencies between the layers
Specifically, what happens when you want to call some sort of "create" method in your service layer?
I'm using Struts2 as my controller. Here's a simple example
Here's a simple service:
The question is, what goes in the controller's (action's) call to the service? (i.e. line 15 in the action)
If you build a domain object in the controller and pass it to the service, then what's the point? You'd have to import the domain object into the controller and you could just call the business methods directly from the domain object.
If you make the service's createXxxx method accept a bunch of primitives, then you could end up with a very big parameter list, which is bad too.