-
Notifications
You must be signed in to change notification settings - Fork 6
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
bgg01590 #7
base: main
Are you sure you want to change the base?
bgg01590 #7
Conversation
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 this.answer; | ||
} | ||
|
||
public String getAnswer() { |
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 void initAnswer(){ | ||
this.answer = generateAnswer(); | ||
System.out.println(this.answer); |
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.
주현님, 코드 잘 읽었습니다!
구조도 깔끔하고 네이밍도 좋아서 잘 읽히는 코드였습니다.
몇 가지 커멘트 남겼으니 확인해주시면 감사하겠습니다!
1주차 고생하셨습니다~!
import camp.nextstep.edu.missionutils.Randoms; | ||
|
||
public class AnswerGenerator { | ||
private String answer; |
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.
~~or, ~~er 등 역할의 이름으로 끝나는 클래스는 보통 util성 클래스가 많은 것으로 알고 있습니다.
generateAnswer()를 static 함수로 두고, String answer = AnswerGenerator.generate()
등으로 사용하는 방법은 어떨까요?
굳이 answer를 필드로 가지고 있지 않아도 될 것 같습니다!
private final BaseballRuler baseballRuler; | ||
|
||
public Baseball() { | ||
this.answerGenerator = new AnswerGenerator(); |
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.
좋네요! 아직 스프링을 사용하지는 않지만 Baseball 생성자의 파라미터로 두 클래스를 두면 의존성 주입이 가능할 것 같습니다!
int balls=0; | ||
for (int i = 0; i < 3; i++) { | ||
if (answer.contains(String.valueOf(input.charAt(i))) | ||
&& answer.charAt(i) != input.charAt(i)) { |
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.
이 로직이 위의 countStrikes 내부의 핵심 로직과 겹쳐서 보통 합치는 것으로 생각했는데, 이렇게 분리를 해도 깔끔한 것 같네요 :+1
늦제출합니다 (_ _),,
통커밋도 죄송합니다 ㅁㅁ