面向高级 PHP 开发人员的 MVC
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16356420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MVC for advanced PHP developers
提问by Ivan
I need some help from more experienced programmers. I want to improve my MVC skills. But I could not find a good tutorial on Google for MVC. Google always gives "MVC for beginners".
我需要更有经验的程序员的一些帮助。我想提高我的 MVC 技能。但是我在 Google 上找不到关于 MVC 的好的教程。谷歌总是为初学者提供“MVC”。
I understand what MVC is and I can make it, but I'm not experienced enough to do something practical in OOP.
我了解 MVC 是什么并且我可以做到,但我的经验不足,无法在 OOP 中做一些实际的事情。
If anyone knows a good object-oriented tutorial for MVC, please direct me to the right place — I'm looking for good links, books etc.
如果有人知道一个很好的 MVC 面向对象教程,请指引我到正确的地方——我正在寻找好的链接、书籍等。
回答by tere?ko
Links, that contain PHP-only materials, are marked with phpfor easier identification.
包含纯 PHP 材料的链接标有php,以便于识别。
You cannot even begin to delve into MVC before you have comprehensive understanding of OOP. That include OOP practices (dependency injection, unit testing, refactoring)principles (SOLID, SoC, CQS, LoD)and common patterns (and no, singleton is not an object-oriented pattern).
在全面了解 OOP 之前,您甚至无法开始深入研究 MVC。这包括 OOP 实践(依赖注入、单元测试、重构)原则(SOLID、SoC、CQS、LoD)和常见模式(不,单例不是面向对象的模式)。
MVC is an advanced architectural design pattern, which requires solid understanding. It is not meant for beginnersor for tiny "hello world" applications. One uses MVC to add additional constraints to the codebase, when simple adherence to OOP practices becomes too loose to control the codebase.
MVC 是一种高级的架构设计模式,需要扎实的理解。它不适用于初学者或小型“hello world”应用程序。当简单地遵守 OOP 实践变得过于松散而无法控制代码库时,可以使用 MVC 向代码库添加额外的约束。
The best I can suggest for you would be to begin by expanding you knowledge regarding object oriented code:
我可以为您建议的最好方法是首先扩展您关于面向对象代码的知识:
The two lectures above should cover the basics. And then move on to:
上面的两个讲座应该涵盖基础知识。然后继续:
When you understand all that was explain in this series, you can expand on:
当您理解本系列中解释的所有内容后,您可以扩展:
- Don't be STUPID, Grasp SOLID!php
- The Principles of Agile Design
- Advanced OO Patterns(slides)php
- Beyond Frameworks(slides)php
- Agility and Qualityphp
- Beyond Design Patternsphp
Also, I would strongly recommend for you to read (in this order):
另外,我强烈建议您阅读(按此顺序):
- Design Patterns Explained
- GUI Architectures
- Inversion of Control Containers and the Dependency Injection pattern
- Patterns of Enterprise Application Architecture
- Domain-Driven Design: Tackling Complexity in the Heart of Software
P.S.:you might also take a look at this book (cautiously, because it has issues): Guide to PHP Design Patternsphp
PS:你也可以看看这本书(谨慎,因为它有问题):PHP设计模式指南php
回答by bitWorking
What I recommend to you is a book about design patterns. Most of these books also cover the MVC pattern and the other patterns are worth to know if you building a complete framework.
我向你推荐的是一本关于设计模式的书。这些书籍中的大多数还涵盖了 MVC 模式,如果您构建了一个完整的框架,则其他模式值得了解。
One good book is PHP Design Patterns. I don't know if it exists in english but I would search for other books and compare the contents.
一本好书是PHP 设计模式。我不知道它是否有英文版,但我会搜索其他书籍并比较内容。