-
Notifications
You must be signed in to change notification settings - Fork 171
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
[4기-황준호] View 패키지 생성 및 구현 #739
base: juno-junho
Are you sure you want to change the base?
[4기-황준호] View 패키지 생성 및 구현 #739
Conversation
변경된 파일은 다음과 같습니다
|
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.
👍
if (voucherType == 1) { | ||
outputView.print("할인할 금액을 입력하세요."); | ||
} | ||
if (voucherType == 2) { | ||
outputView.print("할인율을 입력하세요 (1% ~ 100%)"); | ||
} |
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.
분기처리를 고민해보세요
public void printStartMessage() { | ||
outputView.print(START_MESSAGE); | ||
} |
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.
START_MESSAGE는 printStartMessage에만 쓰이고 있는데, 굳이 변수로 뺴야할 이유가 있을까요?
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.
그럼 메서드 안에 그냥 놔두는게 나을까요?
매직넘버 상수로 분리하는 느낌으로 분리했습니다!
if (voucherType == 2) { | ||
outputView.print("할인율을 입력하세요 (1% ~ 100%)"); | ||
} | ||
return StringUtil.convertStringToInt(inputView.read()); |
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.
return StringUtil.convertStringToInt(inputView.read()); | |
return StringUtil.convertStringToInt(read()); |
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.
InputView와 OutputView로 책임을 분리한 것 치고는 Console의 로직이 너무 복잡하다는 느낌이 들어요.
좀 더 추상화에 대해 고민해보시죠...!
인창님 죄송한데 도저히 감이 잡히질 않습니다 ㅠㅠ |
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.
Console 같은 경우에는
Voucher와 관계 없이 순수하게 Console의 역할을 하는 메소드와 ex) read(), print()
Voucher와 관련된 메소드들이 뒤섞여 있다는 느낌이 들어,
이 둘을 분리해서 사용할 수 있다면 좀 더 객체지향적일 수 있겠다는 생각이 들었어요.
하지만 이렇게 하기 힘들다면 VoucherConsole과 같은 바우처와 관련된 기능을 하는 콘솔이라고 이름을 바꾸면 좋을 것 같아요.
int voucherType = console.readVoucherTypeToCreate(); | ||
int discountAmount = console.readVoucherDiscountAmount(voucherType); | ||
int voucherAmount = console.readVoucherAmountToCreate(); |
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.
저는 값을 입력 받는 것이 console의 역할이라고 생각하고,
이 값들이 어떤 의미를 가지는지는 알 필요 없다고 생각해요.
VoucherType, VoucherDiscountAmount, VoucherAmount의 값은 console이 아닌 해당 객체를 사용하거나 검증할 책임이 있는 객체에서 진행하는게 맞다고 생각합니다.
📌 과제 설명
👩💻 요구 사항과 구현 내용
✅ 피드백 반영사항
✅ PR 포인트
🟣 궁금한 점
지금은 어떻게 관리해야할지 판단이 서지 않아 상수로 분리 시키지 않은 것도 있습니다.