Question

JAVA PROGRAMMING What is an example of a time the Model is allowed to directly change...

JAVA PROGRAMMING

What is an example of a time the Model is allowed to directly change the View?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

This is a controversial topic in MVC/MVVM. Some say it is OK for the Model to access the View directly, other say you should wrap the Models in ViewModels in order to abstract them away from the View.

The one of the primary goals of MVC/MVVM is to decouple the UI, business logic and data. So with that concept in mind, allowing the View to directly access the Models creates a dependency that you might not want to have. On the other hand, wrapping the Models in ViewModels is often tedious and not very useful as the ViewModels tend to act simply as a pass-through to the Models.

One scenario when a model can change the View is like this. Suppose on clicking a button, the button text should change. In this case, based on the code complexity, the Model may come in between and directly update the view.

Add a comment
Know the answer?
Add Answer to:
JAVA PROGRAMMING What is an example of a time the Model is allowed to directly change...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT