Skip to content

Comments

[레거시 코드 리팩터링 - 3단계] 레넌(조형래) 미션 제출합니다.#421

Merged
wishoon merged 6 commits intowoowacourse:broraefrom
brorae:step3
Nov 9, 2022
Merged

[레거시 코드 리팩터링 - 3단계] 레넌(조형래) 미션 제출합니다.#421
wishoon merged 6 commits intowoowacourse:broraefrom
brorae:step3

Conversation

@brorae
Copy link

@brorae brorae commented Nov 4, 2022

안녕하세요 루키~
이번 미션에서도 Jdbc로 이어서 진행해보았습니다.
패키지를 나눈 기준은 생명주기가 같은 것 기준으로 묶어보았습니다.
도메인간의 양방향 참조는 생기지 않았고, 패키지간에는 Order와 Table 간에 양방향 참조가 생겼습니다.
Service 레이어를 한번더 추상화하는 방식으로 진행해보았습니다.
1,2단계가 날아가서 files changed가 많네요.
이번에도 잘 부탁드립니다!

* docs: 요구사항 정리

* test: ProductService 테스트 코드 작성

* test: MenuGroupService 테스트 코드 작성

* test: MenuService 테스트 코드 작성

* docs: 요구사항 정리 수정

* test: MenuProduct 생성자 변경

* docs: 테이블 관련 요구사항 추가

* test: OrderService 테스트 코드 작성

* test: TableGroupService 테스트 코드 작성

* test: TableService 테스트 코드 작성

* style: 코드 스타일 통일

* refactor: 테스트 코드 수정

* refactor: 중복되는 어노테이션 분리

* refactor: DatabaseCleaner를 통한 테스트 격리

* docs: 요구사항 수정

* test: MenuServiceTest 추가 작성

* docs: 중복되는 부분 제거

* test: TableGroupService ungroup 테스트 작성

* test: DisplayName 상세하게 수정

* test: BeforeEach 작성 및 given절에서 service로직을 적용하지 않도록 수정

* docs: 누락된 요구사항 추가

* docs: TableService 테스트 추가 작성

* test: Order, Menu 조회 테스트 수정
@brorae brorae requested a review from wishoon November 4, 2022 04:24
@brorae brorae self-assigned this Nov 4, 2022
Copy link

@wishoon wishoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 레넌~ 루키입니다.
바쁜 와중에도 미션 병행하신다고 고생하셨습니다 👏

간단하게 궁금한 점 몇가지를 남겼는데요!! 확인해주시고 코멘트 부탁드릴게요 🙇‍♂️


private final OrderRepository orderRepository;
private final OrderTableRepository orderTableRepository;
private final TableDomainService tableDomainService;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Domain Service를 통해서 구현해주셨네요!! 저는 Domain Service를 사용해보진 않았는데, 레넌이 생각하시기에 Domain Service를 사용함으로서 얻는 이점이 뭐라고 생각하시나용??

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 이번 미션을 계기로 validator와 domain service에 대한 개념을 알게되었는데요. Domain Service의 장점은 테스트를 작성하기 간편한다는 점인 것 같아요 ! 개인적으로는, 해당 메서드의 흐름을 한 눈에 알아볼 수 있어서 더 좋다고 느꼈습니다.

Comment on lines +5 to +13
import kitchenpos.menu.application.dto.MenuCreateRequest;
import kitchenpos.menu.application.dto.MenuResponse;
import kitchenpos.menu.domain.Menu;
import kitchenpos.menu.domain.MenuProduct;
import kitchenpos.menu.domain.MenuProducts;
import kitchenpos.menu.domain.repository.MenuRepository;
import kitchenpos.menugruop.domain.repository.MenuGroupRepository;
import kitchenpos.product.domain.Product;
import kitchenpos.product.domain.repository.ProductRepository;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table과 TableGroup도 패키지를 분리해주셨네요!! 이번 미션을 하면서 레넌이 패키지를 분리하신 기준이 혹시 있을까요?? (궁금)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

생명주기가 같은 것 기준으로 패키지를 나누어보았습니다. Menu와 MenuProduct 같은 경우는 함께 생성되고 제거되기 때문에 같은 패키지에 두었고, Table과 TableGroup 같은 경우에는 생명주기가 아예 다르다고 생각해서 패키지를 분리해주었습니다 !


private final OrderRepository orderRepository;
private final OrderTableRepository orderTableRepository;
private final TableDomainService tableDomainService;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

의존을 끊기 위해서 Validator 방법도 고려해보셨을 것 같아요!! Domain Service와 Validator 방법 중 Domain Service를 선택하신 이유가 궁금합니다 😋

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validator를 사용한다면 서비스 로직에서 Validator 로직을 읽기 위해서 한 댑스 더 들어가서 봐야한다는 점이 있을 것 같아요. 도메인 서비스를 활용한다면 해당 메서드의 로직 흐름을 한눈에 알아볼 수 있다는 장점이 있는 것 같습니다 !

Comment on lines +13 to +14
public class TableDomainServiceImpl implements TableDomainService {

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table <-> Order 양방향을 끊어내기 위해서 어느 방향을 끊을지 고민하셨을 것 같아요!! 래넌은 Table -> Order 관계를 끊어주셨는데 이렇게 구현하신 이유가 궁금합니다 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

루키의 말씀대로 Table -> Order 관계를 끊어줌으로써 Order -> Table 관계로만 유지하도록 했습니다. 테이블은 주문을 위해 존재하기 때문에, 즉, 테이블이 없으면 주문이 없을 것이라고 생각했습니다.

Copy link

@wishoon wishoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 레넌!! 코멘트들 확인했습니다 😁 바쁜 일정 소화하고 계실텐데 남은 기간도 파이팅입니다 👍🏻

@wishoon wishoon merged commit 6d13bee into woowacourse:brorae Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants