Here are some suggestions from my experience:

On Mon, Jul 27, 2009 at 4:48 AM, Anders Gunnarsson <and...@metropolis.se>wrote:

> I've used Zend Framework for mid size sites,
> but I'm now planning to use it for a much bigger one.
>
> - Is there a good guide for design patterns and object oriented code in
> zend framework?
>
Design patterns are used all over the framework and help you encapsulate
ideas. MVC is the over-arching dispatch / viewing pattern for ZF, however
this is only a small part of the whole architecture. You'll be creating view
helpers, complex domain objects and elaborate persistence mechanisms that
will require better patterns than just looking at the "M" in MVC as a
generic Model.


>
> Some thoughts I'd like answers to:
> - Where should I put classes that extend framework code?

If you've already written some ZF applications, you'll probably be
collecting a bunch of re-usable objects in your Library/ folder.

for example, if you have a CustomFormElement for Zend_Form, I would put it
in App/Form/Element/CustomElement.php

Things are nice and easy when you inherit and override where necessary or
write your own plugins and keep either in the Library folder in a namespace
that suggests it can be decoupled and re-used in the future.

>
> - Where should I put classes and methods that I can use in both
> controllers, views and view helpers? (And what's the best way to do that?)

If your architecture isn't a pure layered one (where things can't talk
unless they're directly below one another), then I would focus on what the
object does, rather than where it's used. This will help when you write unit
tests and in how you think of an object outside of the system. If its a
lookup, maybe it belongs in a Lookup/ namespace, if its a
Command-Query-Statement object that is passed into  Zend_Db, it might belong
in another namespace where you're keeping prepared statements.


>
> - Can I make a view helper or a view method that inherits $this ? (can be
> good for recurse-rendering trees etc)

Nothing is stopping you from making a new object and passing $this into
it... but I would look for a lighter approach personally.

>
> - Best way to combine stored procedures, zend models and version control
>
SVN / Git is your best friend!

>
>
> regards
> Anders
>

Reply via email to