cancel
Showing results for 
Search instead for 
Did you mean: 

why use a model to interact with controls?

former_member277448
Participant
0 Kudos

hello,

i was having a chat with some one learning UI5 and they asked we should use a model to interact with a control rather than doing it directly.

after much thinking all i could come up with was 'just because' - which is not a very good answer.

so, why use a model instead of directly addressing a control (by its id)?

cheers

pas.

Accepted Solutions (1)

Accepted Solutions (1)

Sharathmg
Active Contributor
0 Kudos

Coz, ID may change? so, id is not always reliable to get and set its data.

Also, if you want to transfer data to the backend service, getting data individually frome ach control is not godo for performance.

Model, conforms to the Model view controller paradigm, which has its advantages - which is well documented.

The biggest benefit(in my view) is that model supports, data binding and mapping, which facilitates the seamless data transfer from view to the backend.

Regards,

Sharath

former_member277448
Participant
0 Kudos

Hello Sharath,

thank you for your helpful reply.

data transfer from from view to backend is a very good point.

some of our forms get rather complex and the thought of managing each control individually is not attractive.

cheers

pas.

Sharathmg
Active Contributor
0 Kudos

I'm glad. Does it convince you to follow the MVC - model based design. ?

Answers (0)