When to use Modules in Zend Framework?

Better Reusability. Assuming your colleague kept the code inside the modules indepedent from other modules, he effectively created a self-contained problem domain. Unlike with your approach, he can more easily copy the entire module over to other applications then.

Thanks for your answer. - you have a good point, like in my approach when I have a forum or admin module its independent on the other module. But for example there is a own user module, which most likly is required by other modules.

The question is when is dependence complexity a reason not to use modules. – Rufinus Aug 25 '10 at 21:35 1 @Rufinus TBH, I find ZF's Modules worthless as long as I cannot download a BlogModule somewhere, run it's installer and bang! My app got a blog.

– Gordon Aug 25 '10 at 21:47 How ca you get the bounty when you answered half of one of his question? I don't mind not getting it but I kinda min you getting it. – Iznogood Sep 4 '10 at 14:52 @Iznogood not my decision.

I answered what I felt I could reasonably answer. I didn't expect to get the bounty. Maybe sometimes less is more?

– Gordon Sep 4 '10 at 15:15 Just checked on meta and it seems you can set a bounty to auto accept the answer with the most votes. So thats that I guess. – Iznogood Sep 4 '10 at 15:17.

Same as you. For major sections of my website like the front-end, admin section, members section, etc... Whats your rule to decide Module or not Module? Is it part of the main site or its own little world just related to the front end?

Especially in regards to design. How do you manage a couple of modules some using the same layout? What are the cons AND pros of my colleague's setup in your point of view?

My God the maintenance. All these folders for nothing at all. Why have your about page and contact page in two different file structures?

Also where does he put admin and members if he uses modules for simple pages? What are the cons AND pros of my setup in your point of view? Really the opposite of the above.

Easy to understand and coherant structure. Its worth it to add its the way the zend team intended us to use it link Another thing to think about is what will your urls look like.Myapp.Com/contact myapp. Com/about myapp.

Com/members/profile myapp.Com/members/profile/edit myapp. Com/members/mail This is one easy way to help organise what will go in modules or controllers.

Thanks for your answer – Rufinus Aug 25 '10 at 21:03 No problems. Great question! – Iznogood Aug 25 '10 at 21:08.

A) For me its all about the size of the application. When you have more than say 10 controllers you might want to think about refactoring some of them into a separate module. If you are planning on building a REALLY BIG application it may be worth spitting it up into modules before you start.

Q) Whats your rule to decide Module or not Module? A) Like I said having more than 10 controllers. Q) What are the cons AND pros of my colleague's setup in your point of view?

A) If it is a small project he is over engineering it which will make it harder for other developers to jump into and will take him longer than needed to develop in the first place. He also runs the risk of confusing himself. Q) What are the cons AND pros of my setup in your point of view?

A) My answer above pretty much covers it, if it's a smaller project your way will be quicker and less confusing in the long run. I prefer this approach and just re-factor if the scope is increased.

Thanks for your answer – Rufinus Aug 26 '10 at 7:43 I wouldn't even go as far as making any sort of rule about number of controllers. The question I ask is: 'Could I stand to benefit from the modules features in ZF by splitting this up? ' – Bryan M.

Aug 30 '10 at 18:20.

...like Job-Module, Product-Module each of this modules mostly have 2 Controllers an IndexController and an AdminController. That description kind of raises a red flag to me. IF this was a really big project that needed to rely on high resusability and IF he coded such modules in a way that they could work independently of other modules in the the system and IF there was a need to isolate the admin area for each module, then this could be considered a reasonable approach.

But I would assume there's likely a dependency between Job and Product, in which case, this module approach sounds like over-engineering. Especially if there seems to be an arbitrary 'rule' being enforced (like one business object per module). Also, most MVC frameworks would assume that if you have Job and Product models, you have Job and Product controllers (not an IndexController for each entity).

The purpose of modules is to segregate logical and presentational areas of your site, not divide up business logic. While it's probably neither here nor there as far as proper MVC is concerned, it doesn't make sense to me to create a module that cannot operate fully independent from other modules.

Thanks for your answer – Rufinus Aug 30 '10 at 23:31 In ZF, the default module controller is named IndexController. That's why they are named this way. Also, there is no rule whatsoever that a Model class has to a have a controller counterpart.

– Gordon Sep 1 '10 at 8:24.

Same as you. For major sections of my website like the front-end, admin section, members section, etc...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions