I’m thinking about the best approach to separate Model View and Controller—for Java and using Eclipse, if it makes any difference.
I used to separate each type’s MVC inside its own package, but I’m start to think that this is not the best approach:
- com.company.client (controler)
- com.company.client.model
-
com.company.client.view
-
com.company.another (controler)
- com.company.another.model
-
com.company.another.view
-
com.company.yetAnother (controler)
- com.company.yetAnother.model
- com.company.yetAnother.view
(assume a lot of different packages, each one with its own view and model)
I thought about use:
- com.company.client
- com.company.another
-
com.company.yetAnother
-
com.company.model.client
- com.company.model.another
-
com.company.model.yetAnother
-
com.company.view.client
- com.company.view.another
- com.company.view.yetAnother
I even thought about putting the controller, model, and view in different projects. Maybe it would be even more modular, and I would be more sure that the view is not using the controller, for example (as the controller project would include the view, but not the reverse).
So what is the best approach to separate M, V, and C?
(consider web and desktop apps, not just web)
The Graal Quest! You have two dimensional matrix with vertical (MVC) AND horizontal (business rules) layers…
For me response is a word: dependencies
Keep searching in “package design/strategy” ; “Granularity”
Some reading
I strongly recommand this one:
GOOD LUCK!