Chào mọi người ạ.Cho em hỏi tại sao trong cấu trúc code spring boot cần tách 1 interface service và 1 class để implement . Tại sao lại không làm thẳng luôn không cần tạo interface ạ .
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Đây là do quy định của mỗi team, vì những lý do khác nhau, có thể là để cho việc thay đổi dễ dàng hơn trong tương lai.
2. Hiện tại anh đang làm thì service viết thằng luôn em ạ, vì việc cài đặt service của anh sẽ không có thay đổi nhiều trong tương lai, nên anh không tách thành interface-impl cho đơn giản.
Dạ.Em cảm ơn anh nhiều ạ <3
Vậy anh nghĩ sao khi bỏ tầng service đi ạ, thật sự em thấy có thể check hoặc xử lý logic ở tầng controller được nếu đơn giản