The following article from Zend gives quite an interesting overview in how to structure an OOP applicationin PHP, in this case a weblog that allows for article posting, addition of comments, user management and internal messaging. The first task is breaking down what role the classes will play in the application:
- Actor Classes: Classes that represent people. Actor classes have their own attributes as well as the ability to perform actions
- Data Classes: Classes that represent data. They have attributes, but usually do not have the ability to perform actions
- Action Classes: Classes that perform actions. Can perform computation as well as act on other objects. More likely than not these classes won’t have specific attributes. Lots of business logic can be contained here.
- Collection Classes: Objects that hold other objects
Click here for the full article.