oop - Appropriate way for business logic layer to deal with its neighbors? -


good morning, have use-case in project says if user isn't logged in application display warning message him , determines if user logged in or not managed bean called loginpagecode, class in business logic layer responsible determine if user logged in or not in order take decision displaying message(that action taken when specific action occurs in jsf page called home.jsf), thought of 2 approaches follows:

  1. make home page determine if user logged in or not , pass final decision business logic class
  2. make business logic class responsible determining if user logged in or not , require deal directly loginpagecode

i want know suitable way of doing point of design.

if business logic layer needs know if user logged in, should pass along information argument.

the business layer should not need know how user authenticated, if needs know if user logged in should given information -- that's separation of concerns you! :)

the main idea can reuse same business rules in entirely different environment, e.g, using different authentication mechanism.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -