Reputation: 3664
I've separated my web app in three layer - REST layer, Service layer, dao layer.
I'm trying to create package structure for this application. I'm having two option -
Option 1:
com.<companyname>.....<domain>.rest
com.<companyname>.....<domain>.service
com.<companyname>.....<domain>.dao
Option 2:
com.<companyname>.....rest.<domain>
com.<companyname>.....service.<domain>
com.<companyname>.....dao.<domain>
for eg.
com.<companyname>.....customer.dao
com.<companyname>.....dao.customer
Which option would you recommend ?
Upvotes: 1
Views: 364
Reputation: 1045
Option 2 is more preferred.
If you need to separate the DAO or service layer for any reason, you will only need to move higher level package and not have to find all domains and their corresponding packages.
I would tweak the option 2 based on number of domain objects and not create separate packages for each domain object. I would generally not keep separate package for domain objects unless there is a pressing reason for that.
Upvotes: 1