2010年8月21日星期六

[fw-mvc] Centralized Stack/Broker or something for Models

Hi all,

I have application which have grown a little bit complex. I use models with
DbTables and Rows and so on.
For example, my module "user" has model User_Model_User in models subfolder,
which has various methods conserning user.

Now when my application has grown and turned complex, I have noticed that I
declare my models here and there all over again during the request.
$contentModel = new Content_Model_Content; is been called in many places
during some request on my application. Only "design pattern" I use for
models is "fat models, thin controllers", so I try to write all operations
to my model instead of writing them to my controllers.

So I was thinking, am I wasting resources? Declaring the same class over and
over again in the same request. Should I have somekind of centralized stack
where to register my Models when needed and the next time the Model is
needed it could be get from this centralized stack?

Model has created a lot of discussion before and it's role seems to be
blurred for many people (and for my self too). Let me know what you think of
this, and if you have done some wise solutions with models, I hope you can
share your solution here.

ps. now I have a solution where I have stack of Models in my Application
Bootstrap which I'll interact from action helper, view helper and from
models too.

-----
br,
--------------------------
Marko Korhonen
Technical Consultant
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Centralized-Stack-Broker-or-something-for-Models-tp2333975p2333975.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: