Pregunta

Lets say I have a Spring MVC, Hibernate Web application that's layered like this.

 Controller class -> Service class -> DAO -> Hibernate -> Actual Database

 Ex:
   getCustomers() -> CustomerService.listCustomers() ->  DAO.customers() -> Hibernate/SQL

So the web tier/Controller gets the data requested. And it does not know the implementations. Internally, it calls multiple classes/methods to get the data.

Our architect thinks, it's not a 'Facade pattern'. Is he right?

¿Fue útil?

Solución

It is not a Facade pattern.

Consider the intent of the facade pattern from here, here and here

"Provide a unified interface to a set of interfaces in a subsystem."

"Wrap a complicated subsystem with a simpler interface."

So the intent is to wrap many subsystems and provide a simplified/unified API. That is not the purpose of the Spring MVC controller at all.

Mostly, in a Facade, you can use the subsystems on their own if you wish, just that it is less clean. So the Facade class is dispensable.

In Spring MVC, you cannot use the subsystems to serve the HTTP request. The Controller class is not dispensable.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top