What is the best definition of MVC?

后端 未结 7 1079
闹比i
闹比i 2020-12-14 04:27

I have been using the Zend Framework with an MVC configuration, read about Ruby on Rails and I plan to explore other MVC frameworks in Python (Django?). I really like the wa

相关标签:
7条回答
  • 2020-12-14 04:31

    The model-view-controller pattern proposes three main components or objects to be used in software development:

    • A Model , which represents the underlying, logical structure of data in a software application and the high-level class associated with it. This object model does not contain any information about the user interface.
    • A View , which is a collection of classes representing the elements in the user interface (all of the things the user can see and respond to on the screen, such as buttons, display boxes, and so forth)
    • A Controller , which represents the classes connecting the model and the view, and is used to communicate between classes in the model and view.
    0 讨论(0)
  • 2020-12-14 04:32

    The most major mistake I find with peoples understanding of MVC is that they think the pattern encompasses more than it does. More specifically people often think:

    • Model = DataBase
    • View = HTML
    • Controller = Business Logic and everything else.

    This is often the way things work in a smaller application but reality MVC is a way to seperate the Business code from the presentation code. The Model does all the real business work. The views provide the look and feel, and the controller maps one to the other.

    0 讨论(0)
  • 2020-12-14 04:33

    MVC is one of three ASP.NET programming models. MVC is a framework for building web applications using a MVC (Model View Controller) design: The Model represents the application core (for instance a list of database records). The View displays the data (the database records).

    0 讨论(0)
  • 2020-12-14 04:34

    I believe the same thing. As far as I am concerned anything that manages to separate the concerns of the display, the data/business objects and the control of those (initialisation, responding to user input) gets the benefit that MVC seeks to provide.

    The aim is to move these items into re-useable components and be able to swap different implementations in and out and also be able to test the individual pieces in isolation. IMO that's what MVC is all about.

    This is a pretty good write up of some of the history and popular implementations of the MVC paradigm. We should add the Model - View - ViewModel pattern that is recommended for WPF in there too.

    0 讨论(0)
  • 2020-12-14 04:37

    The project is divided into three parts:

    1. model: represented into database.
    2. view: represented into your project’s interface that you could do it using html, javaScript and css.
    3. controller: this is your business logic represented into your functions and it is consider the link between the model and view that represent level of security, too.
    0 讨论(0)
  • 2020-12-14 04:40

    I trust the MVC definition given here by Martin Fowler. However, you may want to notice the fact that more or less these framework have their own tweak in it. For example a framework like Django is more Model-Template-Controller due to its templating feature.

    0 讨论(0)
提交回复
热议问题