title: Which functions or what things to write in service layer Java Spring MVC
body: <p>Suppose i have <code>class USER</code> with attributes.</p>
  
  <p>In some examples i see <code>UserService class</code> defined for some functions.</p>
  
  <p>I am confused which things or functions should written in User Class and which things in UserService.</p>
  
  <p>For e,g If i want to write some function To Validate users in database like</p>
  
  <pre><code>validate(user,pass)
  </code></pre>
  
  <p>Where should write those function </p>
  
  <p>Also if i have <code>class ShoppingProducts</code></p>
  
  <p>and i want to get all prodcuts shopped by particular user in which class should i write that function i mean in <code>product class or UserService or ProductService</code></p>