-
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
[라테] 치킨집 미션 제출합니다. #6
base: tdd-minuyim
Are you sure you want to change the base?
Conversation
- MenuOrder 삭
- 테이블에서 오더 기능을 처리하는 기능 추가 - 테이블 주문 내역을 계산할 때 할인 정책을 통해 할인 가격을 계산하는 기능 추
- Payment에 따른 할인 정책 추가
- Exception 발생 시에도 프로그램이 동작하도록 수정 - OutputView 중 잘못된 줄바꿈 수정 - 주문 목록이 계산 후에도 비어있지 않은 점 수정
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.
안녕하세요 라테! 앨런입니다.
가벼운 리뷰 남겼습니다.
미션 진행하느라 고생 많으셨어요!
감사합니다.✌✌
outputView.printTables(tableOrderService.findAllTables()); | ||
int tableNumber = inputView.inputTableNumber(); | ||
|
||
outputView.printMenus(menuService.findAllMenus()); | ||
int menuNumber = inputView.inputMenuNumber(); | ||
|
||
int amount = inputView.inputAmount(); | ||
|
||
tableOrderService.addOrder(new TableOrderRequest(tableNumber, menuNumber, amount)); |
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.
잘못입력하면 바로 에러가 발생하는게 아니라 addOrder에서 터지겠네요..?
사용자 입장에서는 열심히 입력했는데 슬플것같아요ㅠㅠ
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.
저도 공감합니다...
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 boolean runIfNotExit() { | ||
try { | ||
Command command = Command.findByNumber(inputView.inputCommandNumber()); | ||
return !command.execute(chickenController); | ||
} catch (Exception e) { | ||
System.out.println(e.getMessage()); | ||
return true; | ||
} | ||
} |
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/domain/Payment.java
Outdated
return Arrays.stream(values()) | ||
.filter(payment -> payment.number == number) | ||
.findAny() | ||
.orElseThrow(() -> new IllegalArgumentException("해당하는 결제 수단이 존재하지 않습니다.")); |
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 Arrays.stream(values()) | |
.filter(payment -> payment.number == number) | |
.findAny() | |
.orElseThrow(() -> new IllegalArgumentException("해당하는 결제 수단이 존재하지 않습니다.")); | |
return Arrays.stream(values()) | |
.filter(payment -> payment.number == number) | |
.findAny() | |
.orElseThrow(() -> new IllegalArgumentException("해당하는 결제 수단이 존재하지 않습니다. number=" + number)); |
상세한 exception을 남겨볼까요?
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 static Amount sum(Amount first, Amount second) { | ||
return new Amount(first.amount + second.amount); | ||
} |
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.
정적팩터리메서드를 만드셨군요! 싱글인스턴스로 만드는건 어떨까요?
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.
그죠 99까지만 있으면 되니깐 인스턴스를 반환하게끔 하면 되겠네요. 수정했습니다.
public Amount add(int other) { | ||
return new Amount(amount + other); | ||
} |
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 menuOrders.keySet().stream() | ||
.filter(menu -> menu.isSameCategory(category)) | ||
.map(menuOrders::get) | ||
.reduce(0, (subTotal, amount) -> amount.calculateSum(subTotal), Integer::sum); |
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.
comparable을 구현해서 stream.sum()을 하는건 어떨까요?
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.
혹시 예시를 알 수 있을까요? 감이 잘 안오네요 ㅠ
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 class Table { | ||
private final int number; | ||
private final Order order = Order.empty(); |
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.
👍👍
Table table = findTableByNumber(number); | ||
if (table.isOrderEmpty()) { | ||
throw new IllegalArgumentException("주문이 비어 있습니다."); | ||
} |
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.
이 작업이 한번에 일어나긴 어려울까요?
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.
도메인이 담당하면 되겠군요?
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.
안녕하세요 라테!!!
간단하게 남겨드렸습니다!!
좋은 코드 잘 보았고!! 추후 또 피드백 하겠습니다!!
outputView.printTables(tableOrderService.findAllTables()); | ||
int tableNumber = inputView.inputTableNumber(); | ||
|
||
outputView.printMenus(menuService.findAllMenus()); | ||
int menuNumber = inputView.inputMenuNumber(); | ||
|
||
int amount = inputView.inputAmount(); | ||
|
||
tableOrderService.addOrder(new TableOrderRequest(tableNumber, menuNumber, amount)); |
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 boolean runIfNotExit() { | ||
try { | ||
Command command = Command.findByNumber(inputView.inputCommandNumber()); | ||
return !command.execute(chickenController); |
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.
execute가 boolean값을 리턴하니까 어색한데....라테는 어떤가요?
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.
System.exit으로 바로 나가게끔 수정하였습니다.
|
||
final int tableNumber = InputView.inputTableNumber(); | ||
ChickenController chickenController = new ChickenController(inputView, |
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.
생성자가 받는게 아주 많군요!!!
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 category == other; | ||
} | ||
|
||
public int calculateMultiplePrice(Amount amount) { |
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.
앨런에게도 물어본 이야기입니다.
#7 (comment)
라테는 어떻게 생각하나요?
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.
저는 요구사항 중 getter를 쓰지 않는다.
를 지키려다 보니 이런 코드가 나왔네요.
사실 여기서는 감싸여진 클래스가 많다보니 이런 왔다갔다(?)하는 코드가 있는 거라고 생각해서, 이 경우는 getter를 쓰는게 좋을 수도 있을 것 같습니다. 다만 이번 단계에서는 getter 사용 금지
에 초점을 맞춰 진행해보았습니다.
잘 부탁드립니다.
웹처럼 만들려고 하다보니 오잉? 하는 부분이 있으실 겁니다 ㅠ