What is the best definition of MVC?

后端 未结 7 1080
闹比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:54

    See Chapter 14 of the book: Patterns of Enterprise Application Architecture, by Martin Fowler.

    The section on MVC starts with:

    "Model View Controller (MVC) is one of the most quoted (and most misquoted) patterns around. It started as a framework developed by Trygve Reenskaug for the Smalltalk platform in the late 1970s. Since then it has played an influential role in most UI frameworks and in the thinking about UI design."

    It also says:

    "As I think about MVC I see two principal separations: separating the presentation from the model and separating the controller from the view.

    ...

    Of these the separation of presentation and model is one of the most important design principles in software, and the only time you shouldn't follow it is in very simple systems where the model has no real behavior in it anyway. As soon as you get some nonvisual logic you should apply the separation. Unfortunately, a lot of UI frameworks make it difficult, and those that don't are often taught without a separation.

    The separation of view and controller is less important, so I'd only recommend doing it when it is really helpful. For rich-client systems, that ends up being hardly ever, although it's common in Web front ends where the controller is separated out. Most of the patterns on Web design here are based on that principle."

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