0

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?

Toon Krijthe
  • 50,865
  • 37
  • 137
  • 200
atiyar
  • 6,349
  • 6
  • 29
  • 62

2 Answers2

0

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.

Makubex
  • 894
  • 8
  • 15
  • thanks for your help. if you consider V -> VM -> M as a single layer and have a data access layer that deals with back-end accessibility, what exactly your Model (M in the Presentation layer) contains? – atiyar Aug 21 '12 at 18:38
  • The responsibility of the View Model is the logic of user interaction. Anything that deals with how the logical interaction is actualized (presented and manipulated) is the responsibility of the View. Anything else is the responsibility of the Model. – Dan Bryant Aug 21 '12 at 18:56
  • Like I said, Model may or may not be a separate layer. It could be a thin wrapper over your BL or it could be the BL itself. For me it has been both in different cases. – Makubex Aug 22 '12 at 05:47
0

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.