-
Notifications
You must be signed in to change notification settings - Fork 0
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
[feat #16] : 질문 게시글 등록, 상세조회 #17
Conversation
Test Results18 tests 4 ✅ 1s ⏱️ Results for commit 77ecdd2. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
양방향 관계성 주입에 대해서는 지난 논의했던 내용대로 일단 이대로 진행하는게 좋을것 같습니다!
멤머 프로필 필드는 추후 추가하겠습니다~
src/main/java/com/dnd/gongmuin/question_post/domain/QuestionPost.java
Outdated
Show resolved
Hide resolved
src/main/java/com/dnd/gongmuin/question_post/dto/QuestionPostMapper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희가 변환 로직 때문에 Response DTO에서 정적 팩토리 메서드를 쓰기로 했었잖아요. 생각해보니까 변환 로직을 Mapper에 다 넣으면 팩토리 메서드가 필요없지 않나 생각이듭니다. 그리고 단일책임원칙에 따라서 DTO는 변환이 아닌 값을 옮기는 역할만 해도 충분한 것 같은데 어떠신가요..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
처음에 말씀해주신 것처럼 DTO에서는 new로 생성해도 괜찮겠다고 생각되네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
음 위 두 내용이 혼선이 되는데 값을 옮기는 역할만 하기를 말씀하시는 건지 아니면 현재 코드처럼 new로 생성하기를 말씀하시는 건지 헷갈립니다ㅜㅜ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MemberInfo가 RequestDto
인가요? ReqeustDto
라면 MemberInfo를 생성하는 팩토리 메서드는 필요 없다고 생각됩니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추가적으로 Request DTO 경우 DTO 내부에서 toEntity()
를 사용해 Entity를 생성하는 방식 어떠신가요? Entity 내부 정적 팩토리 메서드를 이용하게 되면 DTO <-> Entity
간의 결합도가 높아지는데, DTO 내부 toEntity()를 사용하면 결합도가 낮아지고 Entity의 생성 로직이 변경되어도 DTO에서는 큰 수정사항이 필요 없어져서요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
모든 dto에 팩토리 메서드를 없애고, new로 생성하는걸 말했습니다! mapper 클래스 내에서 변환 로직을 수행하면 팩토리 메서드 존재 이유가 없을 것 같아서요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
음 지금 Mapper 클래스가 따로 안보이는데 미리 말씀하시는건가요?
그리고 저는 rqeustEntity 경우 new 보다 toEntity()
방식이 더 좋아보여요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희 Mapper 클래스를 생성해서 DTO<-> Entity간 변환 로직을 처리하고 컨벤션으로 정했었습니다! 그래서 말씀하신 toEntity()
같은 함수를 mapper 클래스에 생성하면 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 죄송합니다,,ㅜㅜ 컨벤션을 제대로 숙지하지 못했었네요..
그럼 Mapper 클래스가 있으니 말씀대로 모든 dto에 팩토리 메서드를 없애는게 좋겠습니다 :)
다만 dto 생성 시 Builder로 생성하기로도 정해서, new로 생성하지 않고 Builder로 생성하면 될 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request/Response 경우 new를 이용해 생성한다.
어 저희 new를 이용해 사용하는걸로 정했습니다!
DTO는 들어오는 매개변수가 항상 똑같아서 @builder
가 불필요할 것 같다고 얘기 나눴었어요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
492a88d
to
5bd1013
Compare
2f0ef04
to
bec784f
Compare
관련 이슈
📑 작업 상세 내용
💫 작업 요약
🔍 중점적으로 리뷰 할 부분