Archive for May 28th, 2007

SitePoint PHP Blog: Good and Bad PHP Code

On the SitePoint PHP blog today, Kevin Yank shares his thoughts in the form of a list for what makes for “good” and “bad” PHP code.

When interviewing a PHP developer candidate for a job at SitePoint, there is one question that I almost always ask, because their answer tells me so much about the kind of programmer they are. Here’s the question: “In your mind, what are the differences between good PHP code and bad PHP code?”

Among the items on the list for the good side are things like: structure, consistency, security, and portability. He gives a bit of example code that shows the three levels of “goodness” in a script (using $_GET variables).

Continue Reading · Add comment

Pádraic Brady’s Blog: May’s php|architect Magazine - worthy weekend reading

Pádraic Brady has a suggestion for all of the PHP readers out there - two articles in the latest edition of php|architect magazine, the May 2007 edition:

The two that stick in my mind are Jim Delahunt’s “Unicode and PHP: A Gentle Introduction” and Jeff Moore’s “Test Pattern: Model View Controller”. Both are something those seeking illumination on these topics should certainly read.

The first presents an introduction to one of the hottest topics in the PHP world - Unicoding - including a few same scripts to get you going. The second article, a look at the Model/View/Controller pattern that really gets more to what the pattern is about rather than just talking about its structure.

Continue Reading · Add comment

Zend Developer Zone: Zend Framework’s MVC Introduces the ViewRenderer

On the Zend Developer Zone, Matthew O’Phinney has posted an announcement about the latest development on the Zend Framework front - the ViewRenderer module.

Yesterday, I committed a change to core in preparation for the 1.0.0RC1 release that, while breaking backwards compatibility slightly, will also greatly simplify the integration between the controller and view components.

One developer, Ralph Schindler, felt it didn’t go far enough, and posted an issue in the framework issue tracker detailing an idea he had for adding more integrated View dependency injection to Zend_Controller_Action. After some thought and discussion with him, I countered with a new action helper, the ViewRenderer.

This new bit of functionality allows you to get rid of those pesky view objects in Controllers, set default rendering options for the controllers, let you autorender view scripts based on the current action and much more.

Check out the post for some example code.

Continue Reading · Add comment

Chris Hartjes’ Blog: Screencast: Interactive Console for CakePHP

On his blog today, Chris Hartjes has a quick screencast he’s created showing off an interactive testing console he’s worked up for use with the CakePHP framework.

I had suggested in an email to the CakePHP mailing list that an interactive console for doing testing of Models would be good. While at php|tek I spent a lot of time with the CakePHP guys talking about this. Out of it came some more ideas (like the ability to test your routes) and they even implemented a console that spits out API information for you. Very cool stuff. So, I decided to do a little screencast demo of a very early alpha version of the interactive console.

The screencast shows Chris running a test on his own classes, including demonstrating the built-in help the app offers.

Continue Reading · Add comment