MVC allows you to separate your business logic from your presentation layer. This "Separation of Concerns" allows you to quickly find and edit portions of your code. It also enables easy reuse of your UI components across your system.
MVC is mostly for better maintainability of your code. By separating the database logic from the presentational logic from the controller logic you can make changes/rewrites/maintence more easily.
it also solves the problem of "spaghetti code", you can outsorce your HTML/XML/PDF/XSL creation Code to your View/Template engine, get the Data from Your Model(DB/File/RemoteCall,...) and your Controller controls the behaviour of Both, you can also simply exchange the View/Models without even Change the Controller if u implement it right, so you gain Seperation of Concerncs, get better Code & Maintainability and can easily swap components also its easier to manage if your projects grow. I recommend the Usage of a FrontController which selects the right Controller for you depending on the Users input, you can also use Inversion of Control/DependencyInjection Pattern there and let your Controller be configued by your FrontController / Pass DB Connection and lots of lots of lots more funny stuff Now u got a simple application framwork:) Use Zend Instead:)
发布评论
评论(3)
MVC 允许您将业务逻辑与表示层分离。这种“关注点分离”允许您快速查找和编辑代码的各个部分。它还可以在整个系统中轻松重用 UI 组件。
查看 wiki 页面,了解 MVC 的过度学术和技术介绍 http://en.wikipedia.org/wiki /模型_视图_控制器
MVC allows you to separate your business logic from your presentation layer. This "Separation of Concerns" allows you to quickly find and edit portions of your code. It also enables easy reuse of your UI components across your system.
Check out the wiki page for a overly academic and technical introduction to MVC http://en.wikipedia.org/wiki/Model_view_controller
MVC 主要是为了提高代码的可维护性。通过将数据库逻辑与表示逻辑和控制器逻辑分离,您可以更轻松地进行更改/重写/维护。
MVC is mostly for better maintainability of your code. By separating the database logic from the presentational logic from the controller logic you can make changes/rewrites/maintence more easily.
它还解决了“意大利面条代码”的问题,您可以将您的 HTML/XML/PDF/XSL 创建代码外包给您的视图/模板引擎,从您的模型(DB/文件/RemoteCall,...)和您的模型中获取数据控制器控制两者的行为,如果你正确实现它,你还可以简单地交换视图/模型,甚至不需要更改控制器,这样你就可以实现关注点分离,获得更好的代码和模型。可维护性并且可以轻松更换组件
如果您的项目不断增长,管理起来也更容易。我建议使用 FrontController,它根据用户输入为您选择正确的控制器,您还可以在那里使用控制反转/依赖注入模式,并让您的控制器由 FrontController / Pass DB 连接和很多很多配置更多有趣的事情
现在你有了一个简单的应用程序框架:) 使用 Zend 代替:)
it also solves the problem of "spaghetti code", you can outsorce your HTML/XML/PDF/XSL creation Code to your View/Template engine, get the Data from Your Model(DB/File/RemoteCall,...) and your Controller controls the behaviour of Both, you can also simply exchange the View/Models without even Change the Controller if u implement it right, so you gain Seperation of Concerncs, get better Code & Maintainability and can easily swap components
also its easier to manage if your projects grow. I recommend the Usage of a FrontController which selects the right Controller for you depending on the Users input, you can also use Inversion of Control/DependencyInjection Pattern there and let your Controller be configued by your FrontController / Pass DB Connection and lots of lots of lots more funny stuff
Now u got a simple application framwork:) Use Zend Instead:)