Skip to content

Conversation

@malibinYun
Copy link
Member

original / yh -> original / master PR

Copy link
Member

@pci2676 pci2676 left a comment

Choose a reason for hiding this comment

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

특정 행동을 하는 상태값들을 한곳에서 같이 처리할 수 있도록 응집도를 올려보자

Comment on lines +34 to +40
int maxDistance = racingTurns.getMaxDistance();
List<Integer> lastTurnCarDistances = racingTurns.getLastTurnCarDistances();
return IntStream.range(0, carNames.size())
.boxed()
.filter(i -> lastTurnCarDistances.get(i) == maxDistance)
.map(i -> carNames.get(i))
.collect(Collectors.toList());
Copy link
Member

Choose a reason for hiding this comment

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

Winner는 distance와 name으로 결정되는데 그 상태들이 서로 따로 행동하고 있어
나느 응집도가 떨어지는것으로 보이는데 이 상태값들을 하나로 관리할 수 있는 방향으로 리팩토링을 다시 해보면 좋을 것 같아
그렇게 되면 여러 책임이 다른 객체에게 위임될 수 있을것 같아

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