Skip to content

Conversation

@KimGyeongLock
Copy link

아쉬운점

  • 기능 목록 readme 변경 필요
  • 단위 테스트 미작성
  • 객체 지향 프로그래밍 학습을 위해 GPT 사용 -> 함수별 commit 작성하지 못함

=> 다음 미션부터는 이러한 OOP 방식에 유의하여 미리미리 할 수 있도록,,

배운점

  • 전체를 관리 및 시작하는 class (start 또는 play 함수를 포함한다)
  • domain 객체에 핵심 비지니스 로직이 들어간다. <도메인 주도 설계(DDD)> (김영한 강의에 나온다,, 좀더 공부필요)
  • View
    • InputView : input의 모든 것
    • OutputView : output의 모든 것
  • Service : 일반적인 비지니스 로직
  • Rank와 Result는 출력 개수가 많을 경우 가독성있게 알잘딱깔센

Copy link

@alreadysons alreadysons left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!

*/
public void start() {
int money = lottoInputView.receiveUserMoneyInput();
List<Lotto> lottoList = lottoService.generateLottoNumber(money / 1000);

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.

magic number를 사용하는 방법으로 바꿔보겠습니다!

return Integer.parseInt(input);
}

private void validateMoneyInput(String input) {

Choose a reason for hiding this comment

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

예외처리를 클래스를 만들어 따로 빼는 방식에 대해 생각해보면 좋을것 같습니다!!

for (LottoRank lottoRank : LottoRank.values()) {
if (lottoRank != LottoRank.NONE) {
//println (X) print(X) printf(O)
System.out.printf("%s - %d개\n", lottoRank.getDescription(), result.getCountForRank(lottoRank));

Choose a reason for hiding this comment

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

println이 아닌 printf를 쓰신 이유가 있으실까요??

Copy link
Author

@KimGyeongLock KimGyeongLock Oct 5, 2024

Choose a reason for hiding this comment

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

이 코드에서는 System.out.println(rankDescriptions.get(i) + " - " + rankCounts.get(i) + "개");
이렇게 println을 사용할 수 있겠지만
아래 printProfitRate 함수에서 System.out.printf("총 수익률은 %.1f%%입니다.\n", profitRate);
여기서 printf를 쓴 이유는 printf 는 %.1f% 와 같이 출력 형식을 제어할 수 있습니다.
또한 가독성도 높아지는 것 같아 사용하였습니다.

Copy link
Member

@yohanii yohanii left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!
stream, enum 활용법에 대해 배웠습니다👍


import java.util.List;

public class LottoOutputView {
Copy link
Member

Choose a reason for hiding this comment

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

InputView, OutputView가 입출력만을 담당하면 좋을 것 같고,
InputView, OutputView가 다른 class를 의존하는 것보다, 다른 class에서 InputView, OutputView를 의존하면 더 좋을 것 같습니다!

Copy link
Author

Choose a reason for hiding this comment

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

다른 class를 의존한다는게 현재 OutputView 코드 내의 printWinningStatisticsprintLotto 에서 Lotto나 LottoResult class를 파라미터로 받고 함수 내에서 사용한다고 이해해도 될까요??

Copy link
Member

Choose a reason for hiding this comment

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

네 맞습니다!

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