Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it ok to have MVVM without model for temporary things? [closed]

Tags:

mvvm

wpf

Do you think it is alright from architectural stand-point to have ViewModel - View without Model for temporary things?

E.g.: I want users to input some paths so I can open some files later on. It doesn't make sense for me to store the paths anywhere just ViewModel and when the user clicks "Show all files" I then construct models of the files and ViewModels for View that represent them somehow. So really my only model is the model of the file.

like image 771
Kugel Avatar asked Dec 23 '22 00:12

Kugel


1 Answers

I think sometimes people mistake design and architectural patterns as hard and fast rules. We need to understand that these are just guidelines. One example of this could be the way different programming languages implement singleton pattern.

So I would say if you need the functionality of View Model to be bound to View but really don't require a model, there shouldn't be any problem in ignoring the model. I would suggest use these patterns as guidelines and not as hard and fast rules. Feel free to make minor adjustments wherever applicable.

But at the same time keep in mind that you are not violating the purpose with which these layers are created. It should not happen like we bypass the model and start querying the backend database directly from the View Model. As long as the basic principle of separation of concerns is adhered to everything should be fine.

like image 200
Nilesh Gule Avatar answered Jan 11 '23 02:01

Nilesh Gule