dimanche 11 octobre 2020

Is opening database connection and CRUD operation in the same class break the SRP?

I am trying to create CRUD using Servlet, JSP and JDBC for learning purposes and i have several points on that:

Is opening connection with the database in the DAO class consider breaking to the SRP since we have two responsibilites here(create connection and CRUD operations)?

Which is better/best practice, creating one servlet to handle all the request or serveral servlets, each one handles just one operation, like UpdateController, DeleteController and so on....

If I can just go from the Home page(That list all the data) to the addData-form page dirctly from the Home.jsp, is that better than make request to the servlet and then the servlet will redirect me to the addData-form page again?

If i can make one JSP page handle Creation and Updating opetions(one form, different urls), Is it good idea?

Aucun commentaire:

Enregistrer un commentaire