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

[주문] 유재현 미션 제출합니다. #3

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

jhyoo1203
Copy link

주문 미션 코드 제출합니다!

  1. OrderService와 OutputView의 책임이 불분명해졌는데 이걸 어떻게 해결하면 좋을 지 조언 부탁드려요!
  2. 테스트 작성에 대한 부분도 조언 부탁드립니다.👍

좋은 미션 만들어주셔서 감사해요☺️

Copy link

@le2sky le2sky left a comment

Choose a reason for hiding this comment

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

재현님 안녕하세요. 6기 아톰입니다. 답변이 늦어진 점 죄송합니다.
미션 풀어주셔서 감사합니다. 더욱 궁금하신 부분이 있다면 편하게 말씀 주세요. 😀

Comment on lines +14 to +27
public static void printOrderWithPrice(Map<String, Integer> orderMap, DeliverCostValidator deliverCostValidator) {

for (Map.Entry<String, Integer> entry : orderMap.entrySet()) {
String menuName = entry.getKey();
int quantity = entry.getValue();

Menu menu = findMenuByName(menuName);

if (menu != null && !menu.getCategory().equals(Category.SERVICE)) {
int itemTotalPrice = menu.getPrice() * quantity;
totalPrice += itemTotalPrice;
System.out.println(menu.getName() + "(" + quantity + "개): " + formatPrice(itemTotalPrice) + "원");
}
}
Copy link

Choose a reason for hiding this comment

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

OrderService와 OutputView의 책임이 불분명해졌는데 이걸 어떻게 해결하면 좋을 지 조언 부탁드려요!

service를 만드신건 레이어드 아키텍처를 의도하신걸까요? 응용 계층의 역할 중 하나는 여러 표현 계층(console, web)에게 기능을 제공하는 것이라 생각합니다. 그래서 저는 평소에 service가 여러 표현 계층에서 사용할 수 있도록 구현되어 있는가?를 생각하면서 코드를 작성합니다. 추가로 궁금하신 부분이 있다면, 말씀 주세요. 😀

Comment on lines +5 to +10
ORDER_INPUT("주문하실 메뉴와 수량을 입력해주세요. ex) 피자(2개), 감자튀김(1개), 콜라(3개)"),
ORDER_DETAILS("\n[주문 내역]"),
SERVICE("\n[서비스]"),
FINAL_PAYMENT_PRICE("\n[최종 결제 금액]"),
TOTAL_PRICE_PREFIX("총 주문 금액: "),
DELIVERY_FEE_PREFIX("배달비: ");
Copy link

@le2sky le2sky Oct 23, 2024

Choose a reason for hiding this comment

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

테스트 작성에 대한 부분도 조언 부탁드립니다.👍

테스트를 작성해야겠다는 의지가 있으시다 생각하고 이야기 드릴게요.
단순히 테스트 코드 관련 책을 한 권 읽는다고 마스터가 되는 영역은 아니라고 생각해요. 개인적인 생각으로는 꾸준한 연습(연구?)이 가장 중요하다고 생각합니다.

우선 초반에는 junit에 대해서 간략하게 살펴보신 다음에 함수에 a를 입력했을 때, b가 나오는 간단한 테스트 코드를 작성하는 연습을 해보시는 것을 추천드립니다. 그리고 어느정도 익숙해진 다음에는 더욱 어려운 테스트를 작성해보고 단계적으로 발전해볼 수 있을 것 같아요. 관련된 학습은 테코톡을 이용해보시는 것도 좋습니다.

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