views:

180

answers:

4

A problem I have when developing PHP using OOP is that I'm never 100% sure on the best practices. I can read any number of tutorials and I understand all the "principles", like catching exceptions and how to build my classes, but I don't know how to integrate it all together properly.

I'm looking for some good quality open source applications that use OOP properly and are examples I should follow. PHPBB3 is awfully built so that isn't an option and from what I understand wordpress is also an awful codebase, so does anyone have any examples of a well built PHP application (using OOP) that I can look at the source code for?

A: 

Zend Framework has gave me a good understanding of OOP. The very good practice is to learn MVC structure. I began from writing simple classes, after this it was abstract classes and interfaces. After this Patterns. Writing the Patterns - is the professional level of programming.

Alexander.Plutov
Knowing *why* and *when* to use a pattern is much more professional than just knowing *how* to write them. Just look at all the unnecessary Singletons out there ;)
Gordon
+1 @Gordon. The converse is also true; knowing when and why something shouldn't be used is equally as important. For instance, the MVC pattern might be heavy handed for a tiny command-line program, or a small maintenance app.
Chris
+1  A: 

SilverStripe CMS / Framework, I use it and it is marvellously put together.. Infact it is almost too splendid for it's own good. They make good use of the MVC pattern and have plenty of OOP examples for you to gawk at.

hydrogen
+3  A: 

Take a look at Kohana. I know it's not an application but it is a very well built framework that's worth a good look at.

davgothic
A: 

Take a look at Magento. It uses parts of Zend Framework and taught me an awful lot about practical PHP OOP in large-scale projects.

demonkoryu
I agree that the ZF has some good structures and practices, but Magento definitely does *not*. It's a shopping cart built by a bunch of designers. Disclosure: I signed the ZF CLA but haven't actually contributed and I organize the Unconference at ZendCon each year.
CaseySoftware