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

숫자 야구 코드 리뷰용 #1

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

숫자 야구 코드 리뷰용 #1

wants to merge 5 commits into from

Conversation

CFalws
Copy link
Owner

@CFalws CFalws commented Dec 1, 2022

No description provided.

@CFalws CFalws changed the title 코드 리뷰 부탁드립니다! 숫자 야구 코드 리뷰용 Dec 1, 2022
Copy link

@greeng00se greeng00se left a comment

Choose a reason for hiding this comment

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

정성스럽게 리뷰 남겨주셔서 감사합니다!
좋은 하루 되세요 CFalws님 😄

public BallNumber getNumber() {
return number;
}
}

Choose a reason for hiding this comment

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

Position을 따로 만들어준게 인상깊어요 👍
다만 클래스명이 볼카운트의 볼과 동일하여 혼동의 여지가 있을 것 같아요!

Copy link
Owner Author

Choose a reason for hiding this comment

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

별 생각없이 이름 지었는데 Ball, Strike를 표현하는 객체로 오인할 수 있겠네요:)

}
return ballNumber;
}

Choose a reason for hiding this comment

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

정적 팩터리 메서드를 볼 때 생성자를 호출하는 부분이 validate를 위한게 아니라 인스턴스를 생성한다는 느낌을 받았어요!
hashMap에서 값을 가져오기 전에 validate 메서드를 호출 하는건 어떨까요?

Copy link
Owner Author

Choose a reason for hiding this comment

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

처음에 그렇게 했는데
특이해보이면 더 좋아보이는 습성이 또 발동했던 것 같네요ㅋㅋㅋ
덕분에 인스턴스 캐싱의 장점을 많이 느낄 수 있었습니다👍

}
return new ArrayList<>(uniqueNumbers);
}

Choose a reason for hiding this comment

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

Streamg.generate를 사용한다면 조금 더 간단하게 메서드를 작성할 수 있을 것 같아요!

Copy link
Owner Author

Choose a reason for hiding this comment

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

메서드 이름도 잘못지었네요😂
hasNotEnough인데..ㅋㅋ
감사합니다!

GameResult.of(0, 0)
)
);
}

Choose a reason for hiding this comment

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

테스트 전용 메서드를 만들어 중복되는 부분을 제거할 수 있을 것 같아요!

List<Balls> generateBall(List<Integer> numbers) {
    return IntStream.range(0, 3)
            .mapToObj(i -> new Ball(BallNumber.valueOf(numbers.get(i)), Position.valueOf(i)))
            .collect(toList());
}

outputView = new OutputView();
}
return outputView;
}

Choose a reason for hiding this comment

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

Lazy 👍

Copy link
Owner Author

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.

2 participants