Thursday, February 17, 2011

Structuring your Zend Framework application

I struggle constantly with the best way to structure my applications. The problem is that there is no single structure or even pattern that works across the board. I have finally come up with a way that works pretty well. I say the route out loud. If the sentence makes sense then the structure likely does.

For example, say I have a user controller with an update action. update user makes perfect sense. On the other hand say I want to fetch a user as JSON for the UI and created a json action. json user does not make much sense, since the action name should be a verb (when was the last time you jsoned a user). A better approach would be to add an open action (open user) and then enable the user to specify the output format.

No comments:

Post a Comment