|[ Team LiB ]|
Where Now, and Was It Worth It?
The code presented in this chapter is not intended as a framework that can be downloaded and used as is. Much more complete and flexible projects are available that you might consider if you are looking for a framework to use from a client coder's perspective.
If you are interested in using a downloaded framework for your PHP code, several projects are available that might be worth evaluating, including Phrame (http://sourceforge.net/projects/phrame) and php.MVC (http://www.phpmvc.net/).
The main objective of this chapter has been to demonstrate some of the issues involved in building larger applications and to point to a few possible solutions, taking in some object-oriented techniques along the way. In particular, we have examined a mechanism for adding new commands to an application flexibly. You have learned some techniques for displaying views as a result of command execution, without embedding the responsibility for presentation in the commands themselves.
The ideas presented in this hour are by no means new. If you are interested in pursuing these topics further, there are some places you can visit to get more ideas.
Unsurprisingly, Java programmers are very much concerned with object-oriented design. Now that PHP has moved toward greater support for object-orientation, PHP coders can benefit greatly from the experiences of their colleagues in the world of Java. The J2EE patterns site at http://java.sun.com/blueprints/corej2eepatterns/index.html has more information on all the techniques described in this chapter.
After the framework is written, applications can be developed relatively smoothly using a framework of this sort, but it has to be admitted that our code expends a lot of resources before we even implement an application. This chapter has implemented a design pattern known as a Front Controller—that is, we have routed all requests through a central switchboard object. A strong body of opinion argues that the Front Controller pattern is wrong for PHP applications. It is argued that this approach is resource hungry and relatively inflexible. This position is eloquently summed up by Harry Fuecks at http://www.phppatterns.com/index.php/article/articleview/81/1/1/.
Whatever conclusion you draw, I hope that you have found the techniques examined in this chapter useful and interesting.
|[ Team LiB ]|