Open
Conversation
JuneYoungDo
reviewed
Aug 28, 2022
| @ResponseBody | ||
| public CategoryResponse create(@RequestBody CategoryRequest request) { | ||
| Long id = service.create(request); | ||
| Long id = service.create(request); |
Collaborator
There was a problem hiding this comment.
잘했는데 전반적으로 네이밍을 조금만 더 신경쓰면 좋을거 같아
우선 그냥 service라 던지 혹인 categoryRepository를 cateRepository라 쓰는 것과 같이 줄여쓰는게, 혼자 개발을 할때는 헷갈리지 않을 수 있어도 협업을 하거나 다른 누군가가 보기에는 가독성이 좋지 않다고 나는 생각해
그래서 웬만하면 네이밍에 있어서 줄임말은 쓰지 않는게좋다고 생각합니당
|
|
||
| @Entity | ||
| @Getter | ||
| @Setter |
Collaborator
There was a problem hiding this comment.
엔티티를 설정함에 있어서 setter의 사용은 지양하는 편이 좋습니다
setter를 설정하게 되면 public으로 설정되기 때문에 어디서든 수정이 일어날 수있고 일관성을 유지하기 어려울 수 있고 어떤 기능인지 정확히 인지하기 어려울 수 있습니당
그래서 setter 보다는 직접 알아보기 좋은 네이밍을 통해 함수를 만들어 수정 기능을 넣어주는 것이 좋습니다~!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
3주차에 구현했던 네이버 예약 시스템에서 데이터를 메모리에 저장하는 것이 아닌, JPA를 사용하는 방법으로 변경하였습니다.
대부분의 변경점은 Entity, Repository, Service에 있습니다.
어려웠던 점
JPA의 findAll()을 사용하여 각각 Entity List를 받아오려고 할 때 StackOverflowError가 발생했었습니다.
이유는 Entity를 작성할 때 양방향 맵핑을 했기 때문에 ToString()이라는 함수가 양쪽 Entity에서 반복되며 무한루프가 생긴 것이었습니다. 한 쪽 Entity에 @JsonIgnore이라는 어노테이션을 추가해주었더니 해결 되었습니다.
코드리뷰 받고 싶은 점
ProRepository에서 제가 별도로 @query를 이용하여 함수를 만들었는데, 이런 식으로 JPA와 Mybatis를 혼용해도 되는 것인지 궁금합니다.
각각 Controller와 Service에서 부족하게 작성된 부분이 없는 지 봐주셨으면 좋겠습니다!