1

One of the business rules is to log which staff does which operation, and the current code passes the whole session facade into the Service (model layer).

Does it sound/smell right? Shouldn't the Controller deals with the Session Facade and extract the data and pass them to the Service instead?

Isn't the primary reason for session facade is for... easy testing of the controller layer? Does passing the whole session facade into the model make sense?

Thx

Henry
  • 32,689
  • 19
  • 120
  • 221

2 Answers2

3

If by Session Facade you mean business flow, then yes the controller should interact with this layer. Passing the Facade into the business model generally would not make sense if they are truly separate layers in the application.

There is a separation between Application Logic (controlled by your Session Facade) and Business Logic (part of the actual Domain Model). These in my mind are two separate layers.

Hope this helps.

tjg184
  • 4,508
  • 1
  • 27
  • 54
1

Typically, my controller level will pass the values into each service method as they are required. The service doesn't care where they came from (session, user submission, etc), it just accepts them, does its work and returns the result. The controller handles grabbing the various values from proper locations (database, session, user submission, etc) and then passing them to the service layer.

Sean Coyne
  • 3,864
  • 21
  • 24