Controller

Problem definition

Controller principle describe which non-UI object should be responsible for reviving, controlling and coordinating of system’s operations. Basically such a role should be delegate to the object which satisfy one of the following requirements:

  • Object is representing a whole system ( façade controller)
  • Object is representing a device on which system is working
  • Object is representing a use case scenario ( session controller)

Analysis

Controller is delegating pattern. UI layer should not contains application logic so objects from this layer should delegate requests to other layer. Controller pattern describes very popular solution used by object oriented developers is situation when this other layer is domain layer.  It points those domain objects which works the best as controllers. Computer systems usually receives input events by the GUI. Other types are receiving external communicates or signals from sensors.In all those cases there is a need of pointing a object which will receive and coordinates requests. Controller pattern often works as a façade separating UI layer from domain layer.

Advantages

Thanks to the controller pattern we make our code reusable and make it possible to connect different interfaces to the same logic.

Follow

Get every new post delivered to your Inbox.