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

[라테] 치킨집 미션 제출합니다. #6

Open
wants to merge 21 commits into
base: tdd-minuyim
Choose a base branch
from

Conversation

minuyim
Copy link

@minuyim minuyim commented Jun 27, 2020

잘 부탁드립니다.
웹처럼 만들려고 하다보니 오잉? 하는 부분이 있으실 겁니다 ㅠ

@minuyim minuyim changed the base branch from master to tdd-minuyim June 27, 2020 14:10
Copy link
Member

@hongbin-dev hongbin-dev left a comment

Choose a reason for hiding this comment

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

안녕하세요 라테! 앨런입니다.
가벼운 리뷰 남겼습니다.
미션 진행하느라 고생 많으셨어요!
감사합니다.✌✌

Comment on lines +28 to +36
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));
Copy link
Member

Choose a reason for hiding this comment

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

잘못입력하면 바로 에러가 발생하는게 아니라 addOrder에서 터지겠네요..?
사용자 입장에서는 열심히 입력했는데 슬플것같아요ㅠㅠ

Choose a reason for hiding this comment

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

저도 공감합니다...

Copy link
Author

Choose a reason for hiding this comment

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

콘솔을 웹처럼 구현하다보니 불가피한 부분이 존재하더라고요...
최대한 도메인을 서비스 안에 있게하고 싶었습니다. ㅠ

Comment on lines 14 to 22
public boolean runIfNotExit() {
try {
Command command = Command.findByNumber(inputView.inputCommandNumber());
return !command.execute(chickenController);
} catch (Exception e) {
System.out.println(e.getMessage());
return true;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

와우...👍👍

Comment on lines 18 to 21
return Arrays.stream(values())
.filter(payment -> payment.number == number)
.findAny()
.orElseThrow(() -> new IllegalArgumentException("해당하는 결제 수단이 존재하지 않습니다."));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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을 남겨볼까요?

Copy link
Author

Choose a reason for hiding this comment

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

또 이런 실수가... 수정했습니다.

Comment on lines 25 to 27
public static Amount sum(Amount first, Amount second) {
return new Amount(first.amount + second.amount);
}
Copy link
Member

Choose a reason for hiding this comment

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

정적팩터리메서드를 만드셨군요! 싱글인스턴스로 만드는건 어떨까요?

Copy link
Author

Choose a reason for hiding this comment

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

그죠 99까지만 있으면 되니깐 인스턴스를 반환하게끔 하면 되겠네요. 수정했습니다.

Comment on lines 29 to 31
public Amount add(int other) {
return new Amount(amount + other);
}
Copy link
Member

Choose a reason for hiding this comment

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

👍👍

Comment on lines +49 to +52
return menuOrders.keySet().stream()
.filter(menu -> menu.isSameCategory(category))
.map(menuOrders::get)
.reduce(0, (subTotal, amount) -> amount.calculateSum(subTotal), Integer::sum);
Copy link
Member

Choose a reason for hiding this comment

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

comparable을 구현해서 stream.sum()을 하는건 어떨까요?

Copy link
Author

Choose a reason for hiding this comment

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

혹시 예시를 알 수 있을까요? 감이 잘 안오네요 ㅠ

Copy link
Member

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();
Copy link
Member

Choose a reason for hiding this comment

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

👍👍

Comment on lines 25 to 28
Table table = findTableByNumber(number);
if (table.isOrderEmpty()) {
throw new IllegalArgumentException("주문이 비어 있습니다.");
}
Copy link
Member

Choose a reason for hiding this comment

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

이 작업이 한번에 일어나긴 어려울까요?

Copy link
Author

Choose a reason for hiding this comment

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

도메인이 담당하면 되겠군요?

Copy link

@kimevanjunseok kimevanjunseok left a comment

Choose a reason for hiding this comment

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

안녕하세요 라테!!!
간단하게 남겨드렸습니다!!
좋은 코드 잘 보았고!! 추후 또 피드백 하겠습니다!!

Comment on lines +28 to +36
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));

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);

Choose a reason for hiding this comment

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

execute가 boolean값을 리턴하니까 어색한데....라테는 어떤가요?

Copy link
Author

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,

Choose a reason for hiding this comment

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

생성자가 받는게 아주 많군요!!!

Copy link
Author

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) {

Choose a reason for hiding this comment

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

앨런에게도 물어본 이야기입니다.
#7 (comment)

라테는 어떻게 생각하나요?

Copy link
Author

Choose a reason for hiding this comment

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

저는 요구사항 중 getter를 쓰지 않는다.를 지키려다 보니 이런 코드가 나왔네요.
사실 여기서는 감싸여진 클래스가 많다보니 이런 왔다갔다(?)하는 코드가 있는 거라고 생각해서, 이 경우는 getter를 쓰는게 좋을 수도 있을 것 같습니다. 다만 이번 단계에서는 getter 사용 금지에 초점을 맞춰 진행해보았습니다.

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.

3 participants