As far as I understand, in many cases sap.ui.require and sap.ui.define are interchangeable. However, there is a convention:
Use
sap.ui.definefor controllers and all other JavaScript modules to define a global namespace. With the namespace, the object can be addressed throughout the application.Use
sap.ui.requirefor asynchronously loading dependencies but without declaring a namespace, for example code that just needs to be executed, but does not need to be called from other code.
I read this statement several times, but I'm not sure I got it completely.
For instance, when I write an UI5-controller for the specific UI5-view, then what should I use? And when I write a BaseController.js, which the rest of the controllers will be based on, then should I chose sap.ui.define or sap.ui.require?