MVVM Pattern Contradiction - Architectural Vs Presentation?

757 Views Asked by At

What is a Presentation Layer Pattern/Presentation Pattern? As far as I know MVVM is an Architectural Pattern, but I see many people, articles, blogs referring it as a Presentation Pattern. And I got confused.

It seems a bit contradictory. If it's an Architectural pattern then it's supposed to deal with all my Presentation Layer, Business Logic Layer and Data Access Layer, right? And I'm allowed to use my Entity Framework generated data-model as the Model. But if it's a Presentation pattern, which I'm guessing is supposed to deal with Presentation only, then I shouldn't be using the the EF generated data-model as the Model since that'll be accessing my Data Access Layer from Presentation Layer.

Can anyone shed some light?

2

There are 2 best solutions below

3
On

Your Views and View-models usually fall in the same layer of the architecture. The main aspect of MVVM is interaction b/w Views and View-models. Models may / may-not be considered to be in a separate layer.

When you have a complex business app that hooks up with Database, file-storage, services, etc it's usually that model becomes an abstract representation of the back-end. But in simple cases like a hello world image viewer - what exactly is a model? There may not even be one.

Big-picture POV, the whole View -> VM -> Model stack looks as a single layer.

0
On

Whether MVVM is architectural or presentation pattern depends on the layer on which much work is involved.

MVVM is a Presentation pattern if the model is easily constructed through a layer and available to be consumed by VM.In this case, much of the work will be on View and ViewModel.

MVVM is an Architecture pattern if the application size is big and involves many layers (Layered architecture) with anything between ViewModel and Data (like Domain layer, Database Access layer, webservice layer) falling under Model.