2009年12月6日星期日

Re: [fw-mvc] Zend Framework modularity and application structure

Personally what I like to do with modules is treat them a lot more like Django contribs. I quite like the approach, it also means that I can get reuse on largely boilerplate features such as authentication, with the minimal amount of effort. (Read as I'm lazy :)).

Basically I write the application largely in the Default_ namespace. So controllers in application/controllers, models in application/models, views in application/views and so on and so forth. It is at this point that once I have my core application in place I will then pull in a module. So I have a very simple comments module and an authentication module. Looking at the authentication module in more detail for this example it comes with a number of roots such as http://example.com/login, http://example.com/logout and http://example.com/register. There are also some controllers backing these roots so Authentication_SessionController->loginAction and Authentication_SessionController->logoutAction.

I do also tend to place admin functionality into a separate module although this is purely for keeping things nicely separated out. It is my preference to use modules to encapsulate common requirements into one package, whilst an administration module has the potential to be quite specific to one application.

Marcus


On 5 Dec 2009, at 16:11, Juozas wrote:

Hello everyone,

as you know, Zend Framework 2.0 is having a major rewrite in some parts and a lot things can be arranged to make development easier/more flexible/etc.

After discussing this with Matthew, I'm asking you to:

Write in short, how do you use Zend Framework

What interests us is how you work with modules (blog, products, news, users), how you divide your applications in to parts (admin, public, something else) and how other parts of code (acl, configuration, resources) comes into play here. 

The reason why I'm asking this, is because I'm using Zend Framework for quote big applications and for me it's important to have ability to create application with self-contained modules and sub-applications. For example I have e-commerce products having admin, public and supplier sub-applications, but everything is still nicely divided into modules (products, warehouse, orders, customers etc.) and App_Application and FrontController plugins does some work to make one application code to be divided in these parts. 

However, I know that some people use applications completely based on acl - there is one site and only depending on what your permissions are, you see data, can edit or delete if you want to. Here again somewhat different structure comes into play. Also quite popular thing to do is to have admin/default modules. Even though I completely don't understand this approach, some people like it and use everyday, hence it should also be possible to use. 

So please write what you think about such things, I will try to read them all, generalize into a comparison table and make it into a proposal of what functions from core are needed to support it (without any hacking, which I done quite a lot)

--
Juozas Kaziukėnas (juozas@juokaz.com)
Aš internete - JuoKaz (http://www.juokaz.com)

Marcus Ramsden
Technical Project Assistant
Learning Societies Laboratory, Electronics and Computer Science
University of Southampton
Room 3069, Building 32, Highfield Campus
Southampton SO17 1BJ
------------------------------------
Skype: cuscus1986



没有评论: