views:

113

answers:

5
backend/
     module1
     module2
     module3

frontend/
     module1
     module2
     module3

or

modules/
       module1/
              frontend               
              backend
       module2/
              frontend               
              backend
       module3/
              frontend               
              backend
+3  A: 

Based on the information you give i would go for the second. Than I would know that the module and all its dependencies resides in this folder. Delete this folder, and the module is gone. If you need to update/disable/replace a module, its convenient to only update one folder.

But, If the modules are not 100% individual and i some cases depends on other modules, I would go for the first option.

PHP_Jedi
+3  A: 

This is purely personal choice really. I have constructed my system to isolate the back-end code from the front-end so that I can maintain strict and precise control over when and where website data is being edited, but that was just my approach. Personally, I don't feel that one way is necessarily better than the other; whichever you prefer is perfectly fine so long as you're consistent.

Nathan Taylor
+2  A: 

Many frameworks go for something similar to your first approach. It works well for team development as front-end developers can be more easily isolated (with SVN and the like) to the front-end directory.

webbiedave
Symfony PHP Framework loosely goes with the first option. I think it is better because there is only one division, rather than several subdivisions.
Christopher Altman
+1  A: 

The choice really depends on what you want to achieve. The first architecture is sort of layering and the second one is about components. Similar struggle goes with MVC versus components (as in desktop GUI etc.). Layers enable you to isolate modules layer by layer, which means, you can build on existing layers. This is used also in the IO/OSI TCP/IP stack. On the other hand components are more granular and can be reused as such - e.g. you can compose desktop GUIs from "widgets". So what is better for the web? Loooking at the mainstream, which is imho MVC, the first layers architecture seems to be used more. Maybe this question is rlated to asking if asp.net is better than sp.net mvc...

Gabriel Ščerbák
+1  A: 

If you are deploying your application across 2 physical tiers (web server and a business server), option 1 would probably be the best fit. That way deployment (copy like deployment or a install based deployment) would be easier to configure or run.

I do like option 2 for ease of maintenance, you can easily tell a developer to go work on "module A" and all the code they need is in one place.

Basically, it is totally a preference up to you and the team. I have worked with both and it really depends on your environment, such as the number of developers and deployment strategies.

Mike Ohlsen