views:

23

answers:

1

Hi guys, I am working on a web application using JSF/Facelets/Hibernate and mySQL.In software requirements, the system should support 5 category of users, each category has access to its own tasks and user interface accessed from a login.

If I split my application in separate modules, in a such a way that each category has its own views-controller and some functions in my model classes, I will be breaking DRY(dont repeat yourself) rules. A quick example is on actions like updating user profile, etc.

I am afraid of getting a Spaghetti Code anti pattern by keeping only one module, in which I will check user category before rendering specific User interface view.

The problem is how better can I apply MVC, avoiding DRY, and better use Modularity in my application. any suggestion, web or paper based resource is welcome. I apologize if my sentences are not clear enough, English is my 3rd language.Thank you very much.

+1  A: 

Why not just use task-oriented shared libraries?

Put all the common code that's used by more than one view-controller in the shared libs.

Ben S
I understood your explanations after using zend framework! I currently have 3 modules, to group same activities and avoid dry, each controller extends base_xxx_controller. and all 'base' classes are grouped into libraries. controllers talks to services(I got this from spring framework), and those services use DAOs, so views and business logic are really decoupled. I appreciate your help.
P.M