Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't see the benefit of using the Command design pattern in this case. <br> 1. The idea with DAO, is to provide an interface that abstract a persistence mechanism. This interface traditionally defines CRUD methods. Each DAO concrete class, would typically implement the DAO interface, for a specific persistence mechanism.For instance, you could have one implementation that stores data into a relational database and another that stores data into an xml file. Both these implementation can be interchangeable since they implement the same inteface.<br> 2. The service functionality can be separated into a separate service layer. Normally, this layer has a dependency on your DAO layer(for persistence). The service interface can be similar to a façade that exposes the business logic implemented in the application (typically, logic in the business layer) to potential clients. Example:<br> <strong>User DAO interface:</strong></p> <pre> public interface UserDao { void save(User user); void delete(User user); void update(User user); User findByUsername(String username); List findAll(); ... } </pre> <p><strong>User Service interface:</strong><br></p> <pre> public interface UserService { void createUser(String username, String password); boolean loginUser(String username, String password); boolean isUsernameUnique(String username); .... } </pre> <p><strong>Service implementation:</strong><br></p> <pre> public class UserServiceImpl implements UserService { private UserDao userDao; public UserServiceImpl(UserDao userDao){ this.userDao = userDao; } ... } </pre>
 

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