10. Controllers

It is highly recommended to inherit your page controller not from the standard sap/ui/core/mvc/Controller, but from your own custom BaseController.

That is, with the following inheritance hierarchy:

  1. sap/ui/core/mvc/Controller — implements the framework's internal methods
  2. BaseController — contains methods reused by all controllers in the application
  3. MyPageController — the controller for a specific page

This way, you keep your code clean and leave only the business logic of the page in the child controller, moving everything else to the parent. This makes it much easier to read, check, and debug.

Utility methods needed in almost all UI5 applications are placed in a common BaseController class, which you can simply connect to your application.


See also