Differentiating between domain, model, and entity with respect to MVC

Martin Konecny picture Martin Konecny · Mar 21, 2013 · Viewed 46.3k times · Source

Can someone explain these 3 concepts and the differences between them with respect to an MVC framework along with an example. To me these appear almost equivalent, and it seems they are used interchangeably in some articles and not in others.

Answer

vertti picture vertti · Mar 21, 2013

The terms are a bit vague I agree. I would use domain to refer to the business area you are dealing with. Like banking or insurance or what not. Then you have domain models. These are the things you deal with in that business domain, like for domain of banking you have accounts, customers, transfers etc. I would use term entity for referencing the class/POJO or the persisted / concrete version of a model.

What probably confuses you here is that in the term MVC, the model is a concrete thing, but it references the data model used to represent some presentation in a web GUI so don't get that mixed in with the above explanation.