Difference Between SAPUI5 Views, Controls, Fragments and Components
As I saw so many doubts regarding Views, Controls, Fragments and Components confusion I am writing this blog to clear those confusions. Suggestions and Corrections are welcomed.
Fragments, Views and Controls are not related to each others.
SAPUI5 Views : Views are nothing but the application pages. We define our user interface by creating Views. Views is formed or created by using one or more Controls in it say Page,SimpleForm,Dialog,Label,Input etc. . Every view has its own controller.
SAPUI5 Controls : Controls the UI elements provided by the SAPUI5 framework. for example Page,SimpleForm,Dialog,Input,
SAPUI5 Fragments: Fragments are the pieces of UI just like SAPUI5 Views. Whenever we need to use some similar UI parts many times in our application/views we create Fragments of those UI parts because Fragments are reusable and are light weight compared to VIews and Controls. Fragments are stored with in the application itself and can be used by that application only. Fragments are defined as View only and calling Views controller is shared with Fragment as Fragments are not having their own controllers.
I have written another blog for reusing UI elements with fragments for more details:
SAPUI5 Components: SAPui5 Components and Fragments are similar but components are reusable and INDEPENDANT parts used in SAPUI5 Applications. An SAPUI5 applications can use components stored on some other locations from where applications is running
Note : Components concept is under development so its advisable not to use it because it may change completely in future(see below image).
I hope above information cleares all doubts 🙂