what is difference between a Model and an Entity

前端 未结 4 1437
青春惊慌失措
青春惊慌失措 2020-12-04 07:00

I am confused to understand what is the meaning of this words:

Entity, Model, DataModel, ViewModel

Can an

4条回答
  •  天涯浪人
    2020-12-04 07:20

    I hope I've not missed your point here king.net...

    Anyway, presuming you're talking about entity modelling or entity-relationship modelling (ERDs):

    • an entity represents any real world entity - e.g. student, course,
    • an entity will have attributes - e.g. student has first name, surname, date-of-birth
    • an entity will have relationships - e.g. student "is enrolled on" course (where student and course are entities with attributes and "is enrolled on" is the relationship.
    • the relationship may be "one-to-one", "one-to-many" or "many-to-many" - e.g. one student "is enrolled on" many courses and similarly one course "has" many students.
    • relationships also have cardinality

    Adding relationships between entities creates a "data model". You've modeled some real world system and the internal entities/ objects in that system. Next step is to normalise it to ensure it meets "normal form".

    In ERD terms, you may have "logical" and "physical" models. The logical describes the data-model in simple high-level terms that witholds the technical detail required to implement it. It represents the system solution overview. The physical model includes technical details required to actually implement the system (such as "many-to-many join tables" needed to implement "many-to-many" relationships).

    Here are some tutorials on-line (though I'm sure there must be thousands):

    • http://www.maakal.com/maakalDB/Database101ERDpart1.htm
    • http://www.itteam-direct.com/gwentrel.htm
    • http://www.bkent.net/Doc/simple5.htm

    I'm not quite sure what you mean by "model" and "view model" in a related context. Not sure if you may be confusing this with Model-View-Controller paradigm (MVC). Here, a model is some data component and the view represents an observer of that data (such as a table or graph UI component). There's lots on-line explaining "model view controller" or "MVC".

    Hope this helps, Wayne

提交回复
热议问题