-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Step5 #6146
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
base: hyoojuu
Are you sure you want to change the base?
Step5 #6146
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.
5단계도 잘 구현해주셨어요! 👏
몇가지 코멘트 남겨드렸는데, 확인부탁드립니다! 🙇
public boolean equals(Car car) { | ||
return equals(car.getPosition()); | ||
} |
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.
상태가 같아도 메모리 주소가 다른 경우와 Hash Collection 을 사용할 경우 동등성 보장이 되지 않을수도 있기 때문이군요!
말씀해주신대로 수정해보겠습니다!
감사합니다.
public class RaceRecord { | ||
|
||
private final Cars cars; | ||
|
||
public RaceRecord(Cars cars) { | ||
this.cars = cars; | ||
} | ||
|
||
public Cars getCars() { | ||
return this.cars; | ||
} | ||
} |
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.
시도 횟수별 자동차들의 상태를 저장하는 객체로 생각했습니다!
sequence 필드를 추가해서 횟수별 자동차 상태를 가지는 객체로 리팩토링해보겠습니다.
|
||
public class RaceRecords { | ||
|
||
private final List<RaceRecord> values; |
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.
private final List<RaceRecord> values; | |
private final List<Cars> values; |
이렇게해도 차이점이 없을것 같아요!
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.
혹시 RaceRecord 객체에 sequence 필드를 추가했을 때, 기존 코드로 사용 가능한거 맞을까요??
sequence 필드 추가한 코드 커밋해보았습니다! 한 번 더 검토 부탁드립니다..!
@@ -2,6 +2,7 @@ | |||
|
|||
import java.util.List; | |||
|
|||
import racingcar.domain.*; |
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.
넵! 수정해보겠습니다.
- [x] CarManager 제거 | ||
- [x] RaceRecord 추가 | ||
- [x] TC 추가 및 리팩토링 |
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.
👍
No description provided.