1

I have a MVC Spring Project using Maven and Tomcat. I am trying to seperate the projcet to subProjects like

  ---Web (Controller and Jsp's) 
 |
  ---Model ( Model classes)
 |
  ---Service
 |
  ---Repository

I want to let everything separate to be clean. I am using Spring MVC & Maven and TomCat. Should I use Maven Modules for these approach or It will be the best to ask Which approach should I use.

SamSamet
  • 395
  • 1
  • 5
  • 20
  • Which approach to use depends on your project however I wouldn't separate based on layer but on functionality (like User, Orders etc.). More a functional separation then a technical separation. You might want to separate the web and functional part but that depends on you. I recommend [this book](http://www.amazon.com/Java-Application-Architecture-Modularity-Patterns/dp/0321247132). – M. Deinum Sep 27 '13 at 18:10
  • It will be cleaner in my opinion to separate the access to DB, define Models and Business Logic. I will also have some sub modules in the business logic as you say depending on functionality. Tanks for you time – SamSamet Sep 27 '13 at 18:26

1 Answers1

0

You have three choices:

  1. service oriented programming pattern.

  2. OSGi modularity.

  3. custom framework using convention using xml database.

for the 3rd I can say that you can use your custom conventions in Dao layer by using collections to store data, for example if going to save object such obj{param1,param2} serialize xml as

<attr1>param1<attr1>

etc to Dao layer and add to XML by iteration over attributes, then serialize to xml and store it.

But let say all of these approaches will not reduction development code size!, but you can reuse many codes in other projects.

Tuna
  • 2,937
  • 4
  • 37
  • 61
Ali.Mojtahed
  • 2,537
  • 1
  • 15
  • 23
  • First I used the module approach. But the Problem was it may look clean but at the background all the modules are coupled to each other that in my case can cause problems in future. Then I separated my Solution into totally 4 Independent Projects as WebProject , ModelProject, ServiceProject, RepositoryProject. This is clean enough. In my opinion :) Thanks for reply. – SamSamet Sep 30 '13 at 20:38
  • So let ask are your repository modules work for any project? or customized for that project?how to speak module with each other? Even if it is not generic modules and standalone for one project why not using layers instead of 3 project? – Ali.Mojtahed Oct 01 '13 at 08:01