Note that there are some explanatory texts on larger screens.

plurals
  1. POQuestion about object-orientation
    primarykey
    data
    text
    <p>I had this questions since the time I learnt about object-oriented programming. Now, I have got a wonderful forum I thought of asking this.</p> <p>Lets say we are implementing an employee management application using EJB.</p> <p>Now, there are 2 ways of doing this.</p> <ol> <li><p>Normally, we create entities (POJOs) which represent an employee. Then we create an EJB interface 'EmployeeManager' with add, delete, update, retrieve, retrieveAll methods. This way I could use 'employee' entity as a data transfer object.</p></li> <li><p>We call the EJB interface itself 'Employee'. Implementation could be called 'EmployeeImpl' which has <em>fields</em> as well as method implementation (add, delete, update, retrieve, retrieveAll). If I am using a layered approach where my business logic needs access to employee details, I need to pass 'EmployeeImpl' (because it contains values).</p></li> </ol> <p>Which one do you think is the better way?</p> <p>I prefer the first one, because it 'looks' fine and does not feel awkward. like</p> <pre><code>EmployeeMgr empMgr = // JNDI lookup; Employee emp = new Employee(); empMgr.add(emp); Employee employees[] = empMgr.retrieveAll(); </code></pre> <p>Where as the second one would look like (though I am not sure),</p> <pre><code>Employee emp = // JNDI lookup; emp.setName(); //set the properties emp.add(); Employee employees[] = emp.retrieveAll(); </code></pre> <p>As you can see, the second one looks awkward.</p> <p>I request you guys to advise me on this.</p> <p>Thanks manju</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload