title: Is package by feature approach good?
body: <p>Recently I came across this javalobby post <a href="http://java.dzone.com/articles/how-changing-java-package" rel="noreferrer">http://java.dzone.com/articles/how-changing-java-package</a> on packaging java code by feature. </p>
  
  <p>I like the idea, but i have few questions on this approach. I asked my question but didn't get a satisfactory reply. I hope someone on StackOverflow can clarify my questions.</p>
  
  <p>I like the idea of package by feature which greately reduces the time for moving across the packages while coding and all the related stuff will be at one place(package). But what about interactions between the services in different packages?</p>
  
  <p>Suppose we are building a blog app and we are putting all user related operations(controllers/services/repositories) in <code>com.mycompany.myblog.users</code> package. And all blog post  related operations(controllers/services/repositories) in <code>com.mycompany.myblog.posts</code> package.</p>
  
  <p>Now I want to show User Profile along with all the posts that he posted. Should I call <code>myblog.posts.PostsService.getPostsByUser(userId)</code> from <code>myblog.users.UserController.showUserProfile()</code>?</p>
  
  <p>What about coupling between packages?</p>
  
  <p>Also wherever I read about package by feature, everyone says its a good practice. Then why many book authors and even frameworks encourage to group by layers? Just curious to know :-)</p>