Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1주차]_2장_의존성 역전하기_김지애 #7

Closed
jiaekim123 opened this issue Feb 13, 2022 · 1 comment
Closed

[1주차]_2장_의존성 역전하기_김지애 #7

jiaekim123 opened this issue Feb 13, 2022 · 1 comment

Comments

@jiaekim123
Copy link
Contributor

책 내용

  • 어플리케이션의 엔티티에 대한 모델을 각 계층에서 유지보수 해야 한다.
  • 도메인 게층은 영속성 계층을 모르기 때문에 도메인 계층에서 사용한 엔티티 클래스를 영속성 계층에서 함께 사용할 수 없고 두 계층에서 각각 엔티티를 만들어야 한다.

질문

DTO
VO
Entity
Req/Res Param

다른 분들은 각 레이어간 데이터를 어떤 식으로 나누었고, 어떤 명칭으로 사용하고 계신지 궁금합니다.

@jiaekim123
Copy link
Contributor Author

(신나게 떠들고 나서 다시 돌아보니 너무 많은 분들이 의견을 주셔서 기억이 나지 않는군요. 기억나는 답변만 정리해봅니다.)

  • Controller와 Service에서 사용하는 객체를 나눌 필요가 있을까?
    • 만약 클라이언트단에서 변경이 필요한 필드가 있으면 서비스에도 영향을 받을 수 있으니 서비스 로직을 보호하기 위해 나누는 것이 좋지 않을까?
  • DTO와 VO를 굳이 나눠서 사용해야 할까? DTO도 불변객체로 선언해도 괜찮지 않을까?
  • 종종 특정 DB를 의미하는 prefix나 postfix가 포함되는 Entity name이 만들어지기도 한다. (예) XXXDocument, XXXEntity 같은 이름이 중복되어 어쩔 수 없는 경우는 이렇게 이름을 짓는다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants