What is an MVC framework and why is it necessary/useful?

前端 未结 9 793
自闭症患者
自闭症患者 2021-02-02 03:01

I know that an MVC framework allows you to separate business logic, data base access and presentation, but why do we need a framework to do this.

Can\'t we just keep ou

9条回答
  •  无人共我
    2021-02-02 03:24

    You are correct, there are strategies that you can implement to help with separation of concerns without using MVC.

    Microsoft's ASP.NET MVC framework is one strategy that can be employed, and that is what I think you are asking about. This MVC framework makes such separation of concerns easy.

    The other major advantage of MVC is testability - (depends on whether you believe in unit testing - I do).
    The MVC framework ensures that all orchestration logic is on your controllers and through the FormControls collection allows full unit testing of all aspects of your application except for how it is presented.

    As the MS MVC framework encourages adherence to common rules and structure of the application which should lead to greater maintainability.

    The major downside of MVC is the code-in-front code weaving required for presentation, but this can be easily overcome.

提交回复
热议问题