2

I have just stepped into the Domain Driven Design paradigm but I have one question:

How is an MVVM Model different from a DDD Entity? What are the differences between these two?

2
  • @RobertHarvey, do you mean both Model and Entity should be handled separately? The reason why i put up this question, I am using my entities as Model currently. Both are same. Aug 16, 2016 at 21:07
  • See my answer below. Aug 16, 2016 at 21:08

1 Answer 1

8

Model–view–viewmodel (MVVM) is a software architectural pattern that separates the development of the graphical user interface from the development of the business logic or back-end logic.

A DDD Entity is something that has identity and type in a business context. For example, airline seats are entities; the airline treats them all the same way (subject to first-class, etc.) However, each seat is an instance with its own identity.

If you were to combine MVVM with Domain-Driven Design, the DDD Entities would become part of the MVVM's Model (but not the ViewModel). For example:

namespace Model
{
    public class AirlineSeat
    {
        // implementation of DDD Entity
    }

    public class FrequentFlyer: Flyer, Person
    {
        // Another DDD Entity
    }
}

Further Reading
Model–view–viewmodel
Domain-Driven Design: Building Blocks

13
  • "If you were to combine MVVM with Domain-Driven Design, the DDD Entities would become part of the MVVM's Model." Can you please explain it further with example. Aug 16, 2016 at 21:11
  • Added an example. Aug 16, 2016 at 21:13
  • Is AirlineSeat is acting as an Entity and Model at the same time? My confusion is whether they are two different things or one thing with two different names? Aug 16, 2016 at 21:14
  • AirlineSeat is part of the model. Think of it this way: none of your DDD stuff is going to go into the View or Controller of MVVM, unless you're referring to it from the model, where it originates. Aug 16, 2016 at 21:14
  • So you mean Model is the place where you can expose your DDD Entity? However both are two separate things, correct? Aug 16, 2016 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.