Questions tagged [mvvm]

The Model View ViewModel (MVVM) is an architectural pattern used in software engineering that originated from Microsoft as a specialization of the presentation model design pattern introduced by Martin Fowler.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
47 views

Model variations depending on requirements - naming and placement

Let's say there is an Item model. Depending on requirements in a given ViewModel (WPF with MVVM) I will need different things. For example in some cases I would need model to have 3 properties: Number,...
2 votes
1 answer
175 views

UML Diagram double arrow

In a Microsoft Learn article on MVVM there is an, what I assume, UML diagram that didn't make sense to me. (https://learn.microsoft.com/en-us/archive/msdn-magazine/2009/february/patterns-wpf-apps-with-...
  • 31
4 votes
1 answer
101 views

Should I have different instances of the same model in an application or just keep a single instance?

What is correct in your opinion regarding the creation and handling of models in an application let's say using MVVM, or even an MVC design pattern? I will try to illustrate the situation I see at my ...
  • 149
0 votes
0 answers
41 views

Models as data containers in MVVM

In the past, when I've used MVC, my model objects were just dumb data containers. Everywhere I read says that in MVVM, models should contain business logic as well as being a data container. Now that ...
0 votes
1 answer
663 views

Folder and Project Structure in MVVM for WPF Solution

I know there are already questions about file structure in MVVM but I haven't found the pros and cons for the following two structures. What would be better for a large-scale project, and why choose ...
  • 3
0 votes
1 answer
89 views

am I understanding MVVM correctly? [duplicate]

ViewModel has Two-way data binding with UI which means UI can access the data from ViewModel and can update the view models data. The Model has one-way data binding and is only supposed to respond ...
  • 9
0 votes
0 answers
151 views

Android clean architecture - RemoteMediator with multiple api dependencies and data sources

From the docs, a RemoteMediator used for pagination can have dependency on: Api Service Database Consider the case when you are paginating a list of items, say a list of books for which you have a ...
6 votes
1 answer
252 views

Does my View Model violate the Single Responsibility Principle? Or am I just used to toy examples from tutorials?

I am a very beginner writing one of my first webapps. I'm using FastAPI and I'm stuck on the logic of creating an endpoint that has to do a lot of things before it returns something back to the user. ...
  • 169
0 votes
1 answer
299 views

MVVM - Wrapping Class For ViewModel

I am using a networking library I created which contains a Client class. I have a GUI which will display all these clients in a ListView with columns, such as one containing their online status. The ...
  • 113
0 votes
1 answer
455 views

Clean code and SOLID principles in WPF/MVVM view models?

I'm currently reading "Clean Code" by Robert Martin (which I should have read years ago), and it's given me a bit of a wakeup call, especially regarding keeping methods and classes small, ...
0 votes
0 answers
200 views

Custom templated controls, user control and MVVM approach

I am developing a data visualisation tool, with some UI interactivity after initial trail with doing it mostly by using templates in XAML and code behind to handle interactive stuff I've realised that ...
2 votes
0 answers
823 views

WPF Best way to create viewmodel from another viewmodel

Often I want to open a new window from within some view. I see opening a window as view logic. So I don't want code in my viewmodel that creates/opens/changes windows or anything else that interacts ...
2 votes
3 answers
515 views

Repository w/ MVVM Pattern: Data Format Check, Where/When, Best Practice?

TL; DR Where/When to check data format in MVVM + Repository Pattern is the best practice? Any suggestion or theory? The Scene Our team is working on an Android Project. We have a MVVM+repo structure: ...
5 votes
2 answers
1k views

In MVVM, how much of the business logic should reside in the View Model, and how much should reside in the Model?

I wondered what is the "correct" or "intended" interpretation of MVVM? I worked mainly with WPF but I guess it is still relevant to all platforms embracing MVVM architectural ...
1 vote
0 answers
72 views

Issue implementing the Command Processor pattern using MVVM for WPF?

I'm trying to implement the Command Processor pattern using MVVM for WPF. The Command Processor pattern that I'm roughly following is the one described in the book Pattern-Oriented Software ...
  • 133
2 votes
1 answer
203 views

Data visualisation application for WPF and MVVM

I was wondering what is the best approach for a Data visualisation application for WPF and MVVM The key points are: The data is loaded, or needs just a little preparation such as pulling out ...
2 votes
1 answer
117 views

How to set up MVVM for highly dependent hierarchical objects with 3D representation

Imagine a program that designs plates with geometric cutouts. You start with a rectangular plate. A plate can have one or more rectangular depressions carved out of it. Each of these can have one or ...
  • 121
0 votes
1 answer
1k views

RESTful web APIs using MVVM architecture

As the title implies, I would like to know if it is possible to create RESTful web APIs using MVVM architecture? Or we can use just MVC pattern to create web APIs?
  • 103
-2 votes
1 answer
78 views

Store/Pass User data MVVM+C swift

I have an app written using MVVM and RxSwift. For navigation I'm using coordinator What is the best way to store user's credentials and pass them to Network Layer. I don't want to sore them in DB or ...
  • 107
2 votes
1 answer
544 views

What is the MVVM way of loading images in list in Android?

Scenario: A very simple android app needed to be developed. It has just one screen with a list of items. Each item has a label and an icon. We fetch the item list from the server, and the server ...
2 votes
2 answers
1k views

What's the better way to do MVVM with a number of very similar view models?

An important view in our application is a big table of entities. For the purposes of this question I'll use an analogy for our entities - so let's say it's vehicles. There's half a dozen different ...
0 votes
1 answer
89 views

Does default deleting behavior of Datagrid violate mvvm pattern and separation of concerns

In WPF when Datagrid's CanUserDeleteRows property is set to true, then conveniently I don't need to implement deletion of elements from an underlying data structure. But it does mean that deletion ...
0 votes
1 answer
58 views

MVVM List<T> from Model to View

I am writing a control app for a 6-DOF robot. This app can send scripts to the robot, which in turn executes these and thus moves around. In the app a robotprogram can be created by adding 3D ...
4 votes
1 answer
5k views

The right place for "app logic" in MVVM context

I hope this is the right place to ask. I'm an experienced developer, and have used MVC for much time. This question is in the context of iOS/macOS development for the most part, (SwiftUI). Using MVC ...
  • 151
1 vote
2 answers
3k views

How are changes propagated from the ViewModel to the Model and how often in MVVM?

I am learning the MVVM paradigm and I have seen a few different implementations surrounding the Model and how it is updated which I want to understand. My understanding of the View and ViewModel ...
  • 127
4 votes
0 answers
842 views

Best practices for viewmodels for SwiftUI preview?

Are there best practices about how to prepare lightweight viewmodels with dummy data, that could be used in SwiftUI previews? Right now, I have a viewmodel for an in-app purchase screen, that needs to ...
1 vote
1 answer
246 views

How to boost reusability and extendability in a MVVM .Net application?

I'm a software engineer that primarily writes C code but now and then makes .Net applications for fun. This is a question about the fun part. Over a duration of about 15 years, I have used and ...
1 vote
1 answer
290 views

How can i handle many children viewmodels in MVVM?

Let's suppose i have a viemwodel which requires a lot of different children viewmodels. An example could be a settings menu: the main viewmodel should be able to load large number of children ...
  • 69
0 votes
0 answers
319 views

In what layer should API be called in Clean Architecture - in Repository or in Use Case?

I am trying to implement Clean Architecture on my Android App with standard MVVM components. Almost every example I have found deals with simple business logic, i.e. simple CRUD operations over data ...
  • 201
-2 votes
1 answer
132 views

WPF MVVM using TPL - should I handle exceptions in the back or front end?

I have a WPF MVVM application, the WPF is the UI frontend and I have another project in the same solution that does DB access, I do this by starting a Task from the frontend that executes the backend ...
1 vote
0 answers
76 views

Should all interactions go to ViewModel?

So basically I guess I know the role of MVVM, but correct me if I am wrong View: Basically it whats the users sees + it takes user interaction Also View: It shouldn't know what the model is ... but it ...
-1 votes
1 answer
779 views

MVVMCross multiple ViewModels and Views per Window

I may not being fully understanding MVVM or how MVVMCross works, but my understanding of views is that they are components of a window rather than the window itself. When you start up MVVMCross in C# ...
  • 101
1 vote
2 answers
912 views

What is the proper way to handle with View and ViewModel in WPF?

Currently, I'm making an Editor with MVVM pattern in WPF. Editor simply take an instance of a specific type as a reference and modifies it. The following code is the expected usage when editor ...
  • 61
2 votes
1 answer
665 views

Does passing a view model down to a properties violate MVVM or OOP?

I'm new to MVVM but experienced in OOP. I have an easy solution to my problem, but I'm not sure if it violates MVVM or OOP or if it is a good practice. I have a set of ViewModel classes in my WPF ...
  • 157
1 vote
3 answers
2k views

Extract Exception handling MVVM

I noticed a pattern in my code, where im repeating a solid amount of code. Let's say my application has 2 layers. UI and Services. I have a FileService class, that has a CopyTo method. Now there are 2 ...
  • 99
0 votes
1 answer
276 views

How do I plan my refactor of my android app for better architecture?

The current structure of my app is as follows: One activity and multiple fragments (about 25 fragments) One huge monolithic repository One huge monolithic viewmodel Databinding is being used but with ...
1 vote
0 answers
655 views

Common business logic in android MVVM

Requirement I am currently working on an android application that uses MVVM, live data and databinding. I have a use-case where I need to show a Comment button in multiple screens in my android app. ...
  • 119
0 votes
0 answers
215 views

WPF MVVM EventAggregator Cons?

We have a wpf mvvm application with a lot of "panes". Just like the draggable panes in visual studio for example. All of these are individual usercontrols with their own viewmodels and im trying to ...
-4 votes
2 answers
95 views

MVVM construction questions

I am trying to understand how MVVM works. Here are two examples (in Andrdoid) on how I understand it should work, please tell me if I understood correctly. I currently want to make a list of ...
  • 11
0 votes
2 answers
124 views

Should a view-model be coupled to a view or to a model?

That is, let's say I have a model that's used in several views. Should I create a single view model to represent it across all those views, or should I create a separate view model for each view that ...
  • 491
8 votes
5 answers
10k views

WPF UserControl Reuse With MVVM

I'm struggling to find an elegant and idiomatic way of coding the following scenario using the MVVM paradigm in WPF and was wondering how other people would approach it. I have a UserControl in my ...
-1 votes
2 answers
672 views

Dependency relations in MVVM and the place of the controller

I know there is plenty of questions about this, but there is a lot of seemingly conflicting information. My assumption: The viewmodel is an abstraction of the view, an interface to the business ...
  • 3
0 votes
1 answer
204 views

CRUD actions rexponsibility in the MVVM

In Form-based application (WPF/MVVM/SQLServer), consider the form that handles the classical actions that you can perform on any entity. Create Read Update Delete The problem, in general terms, is ...
  • 841
0 votes
2 answers
155 views

Services injected with factories

I face an issue where I want to inject Entity Frameworks DbContext into a service class, in a WPF application. The problem is that the service classes are instantiated and contained by the view models....
0 votes
0 answers
84 views

confusion for view's and viewmodel's responsibility in mvvm architecture in android

i have a confusion about what code should be placed in view and what in viewmodel for example click events here is a snippet code of google ToDo app example for showing application architecture (...
  • 187
3 votes
2 answers
1k views

Uncle Bob's Clean Architecture - Dealing with anemic interactors, tiering, and front-end MVVM

Background In Uncle Bob's Clean Architecture, use case interactors are responsible for the orchestration of business objects to accomplish some user goal. As an easy example, an e-commerce application ...
1 vote
2 answers
866 views

Layered Model-View-ViewModel design

I am designing an application using C# and Windows Presentation Foundation (WPF). I would like to follow (at least) the very basic rules of software architecture, like dependicies only going in one ...
5 votes
3 answers
189 views

How to design and join more complex entities

I am developing a small ERP software. I'm wondering how to design entities as well as where to join them. I'm just gonna start with an example, that makes it way easier. Say I'm modelling a ...
  • 375
2 votes
0 answers
64 views

Do MV* architectural patterns apply not only to OO languages but also functional languages?

I am learning about MV* architectural patterns, thanks to the help from several answers here. I learned that they are used for designing the architectures of user interactive applications. I also ...
  • 5,375
2 votes
2 answers
144 views

Where should objects be built from view-models in a layered architecture?

Having the following classes: Person.cs namespace Project.Domain { public class Person { public int Id { get; set; } public string Name { get; set; } public decimal ...

1
2 3 4 5 6