Search code examples
model-view-controllercoldfusioncoldbox

session facade, does it belong to the Model layer or Controller layer?


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


Solution

  • 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.