samedi 22 février 2020

Split huge ViewModel into multiple pieces

It's not a repetitive question. Please read carefully.

I just got this new project and i happily started working on it but as this project is growing bigger & bigger due to regular Clients requirements, i'm afraid that i may run into performance issues.

I've 10 pages. View of each page is similar but with minor changes like different images,boxes,color for each page.I'm using MVVM pattern.So, the architecture i designed is as follows:

  • 10 separate Views pages.
  • 1 ContentView for all these pages which show different designs based on Bindable Properties.
  • 10 different ViewModel as each page contains different functions too, both by design and functionality.But mostly,they contain common properties.So,i created a CommonVM ViewModel with all the common properties in there and the rest of the 10 ViewModels are inheriting it.

Now, here comes the problem. At starting, The CommonVM ViewModel was small but now as my project is growing , i am adding more and more Bindable properties in it.It already contains around 100 Properties and looks like it will grow more.

So,my question is,how can i handle this growing size of CommonVM ViewModel. How can i split it into multiple files or reduce it.

Aucun commentaire:

Enregistrer un commentaire