ui5 How to keep view independent with model
When develope UI5 project we will encounter following issues
- Some times data model cannot easily decide for odata structure can not easily decide
- So our view and model mapping relations is very flexible like following diagram.
- All data model mapping to view should be asynchronized. So the different mapping pattern will affect our coding style a lot.
- Hidden data access method , Using the same interface to access data no matter the data is odata service or just a mock data
- Provide a another glue layer to resolve the mapping issues ,keep the view independent with the model
- Avoid multi synchronized invoke form the view (controller) keep the view be stable.
What to do
How to do
- Using factory pattern to make the data access method change easily
- Different class in charge of different layer task. Decoupling the view and model.
How these objects collaborate?
How to Use? Coding Sample :
Following I will introduce two patterns: One view one model & one view multi model .
Now you will find their coding pattern are same . All complex is hidden .
One view on model .