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

[5기 - 박주한] SpringBoot Part2 Weekly Mission 제출합니다. #943

Open
wants to merge 28 commits into
base: ParkJuhan94-w2
Choose a base branch
from

Conversation

ParkJuhan94
Copy link

👩‍💻 요구 사항과 구현 내용

(기본) 바우처 관리 애플리케이션

  • 바우처 관리 애플리케이션에 단위테스트를 작성

    • 가능한 많은 단위 테스트코드를 작성
    • 엣지 케이스(예외 케이스)를 고려해서 작성
    • AssertJ로 구현
  • 바우처 관리 애플리케이션에서도 과정에서 다루었던 고객을 적용해보세요.

    • customers 테이블 정의 및 추가
    • CustomerRepository 추가 및 JdbcTemplate을 사용해서 구현
  • (1주차엔 파일로 관리하게 했다.) 바우처 정보를 DB로 관리해보세요.

    • 바우처에 엔터티에 해당하는 vouchers 테이블을 한번 정의해보세요.
    • 바우처 레포지토리를 만들어보세요. (JdbcTemplate을 사용해서 구현)
    • 기존의 파일에서 바우처를 관리한 것을 vouchers 테이블을 통해서 CRUD가 되게 해보세요.

(심화) 바우처 지갑을 만들어보세요.

  • 특정 고객에게 바우처를 할당 -> 저는 지갑 메뉴에서 구현

  • 고객이 보유한 바우처를 제거 -> 저는 지갑 메뉴에서 구현

  • 고객이 어떤 바우처를 보유하고 있는지 조회 -> 저는 고객 메뉴에서 구현

  • 특정 바우처를 보유한 고객을 조회 -> 저는 바우처 메뉴에서 구현

✅ PR 포인트 & 궁금한 점

  • repository 에 존재하는 voucherRowMapper 에서, voucher type 에 따른 처리가 객체지향적이지 못한것 같습니다. 어떤 힌트를 주신다면 리팩토링해서 객체지향적으로 만들어보고싶습니다.
  • (심화) 부분의 명세가 자세하지 않아서 기능을 임의로 배치해보았습니다. 이 과제에서 지갑을 잘 활용할 수 있는 배치인지 궁금합니다.
  • 테스트코드는 아직 많이 구현을 못해서 커밋을 못했습니다.. 리뷰 후 리팩토링할 때 함께 pr 하겠습니다!
  • 그 외 따끔한 조언 주시면 감사하겠습니다!

Copy link

@hoon-space hoon-space left a comment

Choose a reason for hiding this comment

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

간단하게 코멘트 남겼습니다. 확인 부탁드려요 ~

repository 에 존재하는 voucherRowMapper 에서, voucher type 에 따른 처리가 객체지향적이지 못한것 같습니다. 어떤 힌트를 주신다면 리팩토링해서 객체지향적으로 만들어보고싶습니다.

-> 맵퍼에서 매번 분기를 하는거라면, 애초에 repository 클래스르 fix 와 pernect 바우처를 분리하는게 좋을 것 같아요.
-> 디비 저장을 어떻게 하는지는 잘 모르겠지만, 테이블이 fix, percent 바우처가 분리가 되었다면 위 처럼 하는게 좋을 것 같고 테이블 하나로 사용하신다면, 굳이 voucherType 에 따른 분기가 필요한가 의문을 가져보셔도 좋을 것 같아요

(심화) 부분의 명세가 자세하지 않아서 기능을 임의로 배치해보았습니다. 이 과제에서 지갑을 잘 활용할 수 있는 배치인지 궁금합니다.

-> 어떤 배치를 말하시는 걸까요 ?? 배치라는 용어가 여러 의미로 쓰이다보니 ....

Comment on lines 3 to 4
public class CustomerDto {
}

Choose a reason for hiding this comment

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

?

Comment on lines 31 to 32
public List<Wallet> getHaveVouchers(UUID customerId) {
return walletRepository.findByCustomerId(customerId.toString());

Choose a reason for hiding this comment

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

getHaveVouchers 보다 좀 더 깔끔한 네이밍 없을까요 ㅋㅋㅋㅋ
너무 콩글리쉬 같아서 ㅠㅠ

Comment on lines +10 to +17
public interface OutputHandler {

void outputString(String message);

void outputCustomer(Customer customer);

void outputVoucher(Voucher voucher);

Choose a reason for hiding this comment

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

콘솔말고는 사용할 곳이 없을 것 같은데, 인터페이스로 구현하신 이유가 궁금해요

Comment on lines +9 to +12
@Service
public class OrderService {
private final VoucherService voucherService;
private final OrderRepository orderRepository;

Choose a reason for hiding this comment

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

서로 다른 도메인의 서비스끼리 참조도 좋지만, 의존 관계가 꼬이게 되기 때문에 파사드 레이어 만들어보셔도 좋을 것 같아요

Comment on lines 5 to 17
public interface Voucher {
UUID getVoucherId();

long discount(long beforeDiscount);

long getAmount();

int getPercent();

UUID getCustomerId();

void setCustomerId(UUID customerId);
}

Choose a reason for hiding this comment

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

인터페이스 vs 추상클래스 고민이 필요해보여요, 저라면 추상클래스

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

Successfully merging this pull request may close these issues.

None yet

2 participants