面向對象程序設計資源
作者 Harry Fuecks 翻譯 Easy Chen 來源 sitepoint.com
PHP從純過程化的語言進化而來,面向對象和麪向過程在其中和諧共存。許多PHP開發者先學習過程化的風格,網絡上很多和PHP相關的資料都着眼於這點。下面是一些爲希望使用OOP的PHP開發者精選的資料。
PHP的OOP閱讀材料精選
- Object Oriented PHP: Paging Result Sets
Kevin Yank 提供了一個關於PHP中的OOP的實用的(也是和PHP相關的)介紹。他的出發點是使用比學習更有效。
- Object Oriented Programming in PHP: The way to large PHP projects
Luis Argerich 的關於PHP中OOP的概觀。它將適用於已經在其它語言中使用OOP的開發者。第一批關注PHP中的OOP的文章之一(如果不是第一篇的話)。
- PHP4: Reference Counting and Aliasing
- PHP(4) and Variable References
解釋PHP4中引用如何工作的文章(PHP5中不再有效,或多或少的)
- PHP (4) Static Class Variables
如何用PHP模擬靜態類變量
(more to come)
Design Patterns
About design patterns
Pattern Repositories
- phpPatterns
- Sun Java Center - J2EE Patterns
- .NET Architecture Center
- Objectmonkey
通用,但是一般使用PHP作演示。
- Patterns Central
Patterns in PHP (selected online articles)
Core Patterns
來自GOF
The Singleton
The Strategy Pattern
Adapter and Proxy Patterns
The Observer Pattern
The Factory Method
The Iterator Pattern
The Decorator Pattern
The Command Pattern
這篇文章還可以改進
The Template Method (in PHP5)
Enterprise Patterns
Patterns with direct relevance to web applications
- Industrial Strength MVC
實例中的MVC,使用PHP和Phrame
- MVC
實現範例
- Simple MVC Examples
9 – 11頁 – 可能是用PHP寫成的最簡單的例子了。
- Model View Controller
簡短的討論。
- Front Controller
一般性的討論和從PHP出發的討論。
- The Front Controller and PHP
用PHP實現front controllers的相關問題。
- Front Controller / Command
討論和PHP實現
- The Registry
如何避免全局變量
- The DAO Pattern
數據訪問對象Data Access Objects
- Incepting Filter
一般性的討論和從PHP出發的討論。
- Intercepting Filters
更多的討論和實現示例
- Template View
Template view的學習 (如 templates) 着眼於PHP和其他語言之間的不同方法
- Page Controller
簡短的討論