dcsimg
Results 1 to 2 of 2

Thread: MVVM and where stuff goes.

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2013
    Posts
    59

    MVVM and where stuff goes.

    Hi Everyone,

    Been a while since I have posted.

    I have a question about MVVM and the separation of concerns. I understand MVVM at a high level, it is when I get into the details that it becomes confusing.

    View = UI -No explanation required.

    ViewModel = Business Logic (Validation, data type conversion, data formatting between the View and the model, exposes properties to the view for data binding.)

    Model = Objects = Properties of the business object (Person, Invoice, Lists of people, Lists of invoices.)

    My question is, where do the methods to retrieve data from the source (database, flat file, etc.) live?

    Thanks,
    Bob H

  2. #2
    Frenzied Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,127

    Re: MVVM and where stuff goes.

    Quote Originally Posted by bholahan View Post
    Hi Everyone,

    Been a while since I have posted.

    I have a question about MVVM and the separation of concerns. I understand MVVM at a high level, it is when I get into the details that it becomes confusing.

    View = UI -No explanation required.

    ViewModel = Business Logic (Validation, data type conversion, data formatting between the View and the model, exposes properties to the view for data binding.)

    Model = Objects = Properties of the business object (Person, Invoice, Lists of people, Lists of invoices.)

    My question is, where do the methods to retrieve data from the source (database, flat file, etc.) live?

    Thanks,
    Bob H
    The ViewModel is really only the View Logic, it shouldn't contain any business logic at all. The ViewModel's role is really to simplify how the View interacts with the user and the Model.

    In MVVM the Model is really describing your business domain and it is where the business logic should be implemented, often the Model will be a separate service or component in your architecture.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width