Skip to content

Sdrs6921#1

Open
sdrs6921 wants to merge 35 commits intomainfrom
sdrs6921
Open

Sdrs6921#1
sdrs6921 wants to merge 35 commits intomainfrom
sdrs6921

Conversation

@sdrs6921
Copy link
Copy Markdown
Owner

@sdrs6921 sdrs6921 commented Nov 4, 2021

No description provided.

Copy link
Copy Markdown

@seonghun127 seonghun127 left a comment

Choose a reason for hiding this comment

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

구현하느라 고생많았습니다~
view와 도메인간의 의존관계를 완전히 끊었고 MVC 패턴을 적절하게 구현했다고 생각합니다.
몇가지 코멘트 남겼으니 확인부탁드려요!

추가로 하나 더 고민해보면 좋을 것이
저번 베이스볼 코드랑 전체적인 포맷은 매우 비슷해서 다른 구조로도 한번 생각해보면 좋을 것 같습니다.
베이스볼과 지금 구현 포맷을 보면 아래와 같은데

  • 게임 -> 라운드 -> 도메인 로직 (요구사항에 맞춰 객체 생성 및 메세지 상호작용)

여유가 된다면 다른 구조도 한번 생각해보는 것을 추천드립니다.

return generateRandom();
}

protected boolean generateRandom() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이게 protected 인 필요가 있을까요?


public class RandomMovementStrategyStrategy implements MovementStrategy {

private final Random random = new Random();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Random 객체가 딱한번 초기화돼서 사용되는 걸로 보이는데 상수로 바꾸는건 어떨까요?

testImplementation "org.junit.jupiter:junit-jupiter:5.7.2"
testImplementation "org.assertj:assertj-core:3.19.0"
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
testImplementation 'org.assertj:assertj-core:3.21.0'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

버전 변경한 이유가 무엇인가요?

.stream()
.map(Car::new)
.collect(Collectors.toUnmodifiableList());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

불필요한 줄이 추가됐네요.

@CsvSource(value = {"name,name,true", "name,other,false"})
@DisplayName("이름이 같으면 같은 해시값을 반환하고, 다르면 다른 해시값을 반환한다")
void hashCode(String value, String otherValue, boolean expected) {
//given
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

IDE로 자동화할 수 있습니다.

https://eomdev.tistory.com/12

Round round = initialRound;

while (round.isOver()) {
round = round.play(movementStrategy);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

프로그램 전반적으로 객체의 불변성을 계속 유지했는데, 여기도 Round 객체를 불변으로 가져가면 어떨까요?

public class GameController {
private final InputView inputView;
private final OutputView outputView;
private final MovementStrategy movementStrategy;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GameControllerMovementStrategy 필드를 가져야할까요?
결국 round 객체에 바이패스될텐데 그렇다면 구체적인 구현체를 직접 round에 직접 전달해도 되지 않을까 싶어요.
어떻게 생각하시나요?

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