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단계 미션 제출합니다. #4

Open
wants to merge 8 commits into
base: uijin-j
Choose a base branch
from

Conversation

uijin-j
Copy link
Collaborator

@uijin-j uijin-j commented May 23, 2024

No description provided.

Copy link
Contributor

@ksy90101 ksy90101 left a comment

Choose a reason for hiding this comment

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

고생하셧습니다.

import java.util.HashMap;
import java.util.Map;

public class CommandFactory {
Copy link
Contributor

Choose a reason for hiding this comment

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

이건 Command에 넣으면 되지 않을까요?
혹시 따로 Factory를 만드신 이유가 있나요?


public class CommandFactory {

private final Map<String, Command> commandMap;
Copy link
Contributor

Choose a reason for hiding this comment

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

Map이라는 단어보단 복수형으로 쓰는게 좋을거 같습니다.

Comment on lines +24 to +29
Map.of(
"1", new PlayGameCommand(
new ConsoleBaseballGame(
inputView, outputView, new RandomBallNumbersGenerator())),
"9", new ExitApplicationCommand(this)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. 이 부분을 따로 분리하면 어떨까요?
  2. 차후 여기서 1과 9에 대해서 알기가 어려운거 같아요. 상수화를 하면 어떨까요?

Comment on lines +15 to +16
private BallNumbers targetNumbers;
private boolean isRunning;
Copy link
Contributor

Choose a reason for hiding this comment

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

ConsoleBaseBallGame에서 상태를 가지고 있는게 이상한거 같아요.
ConsoleBaseBallGame은 어떤 역할을 하는건가요?

Comment on lines +18 to +21
checkArgument(
number >= MIN_BALL_NUMBER && number <= MAX_BALL_NUMBER,
"BallNumber은 " + MIN_BALL_NUMBER + "~" + MAX_BALL_NUMBER + "사이의 숫자여야 합니다."
);
Copy link
Contributor

Choose a reason for hiding this comment

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

다른 생성자 혹은 다른 정적 팩터리 메서드를 만든다면 이 부분은 또 작성해야하지 않나요?
이럴땐 생성자에서 차라리 하면 어떨까요?

public final class Validator {

private Validator() {
// 유틸리티 클래스
Copy link
Contributor

Choose a reason for hiding this comment

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

주석은 제거해도 되지 않을까요?

// 유틸리티 클래스
}

public static void checkArgument(boolean expression, String message) {
Copy link
Contributor

Choose a reason for hiding this comment

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

오 이건 좋네요 👍

BallNumber created = BallNumber.of(number);

// then
assertNotNull(created);
Copy link
Contributor

Choose a reason for hiding this comment

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

assertJ를 적극적으로 활용해보면 어떨까요?

.withMessage("야구 숫자는 1~9사이의 서로 다른 3자리 숫자여야 합니다.");
}

@DisplayName("BallNumbers가 가지고 있는 숫자를 추측하여, 추측 결과를 확인한다. (Case. 3스트라이크)")
Copy link
Contributor

Choose a reason for hiding this comment

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

이런경우 ParameterziedTest를 사용해볼수 있지 않을까요?

BallNumbers generated = randomBallNumbersGenerator.generate();

// then
assertThat(generated).isNotNull();
Copy link
Contributor

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