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

πŸš€ 3단계 - μžλ™μ°¨ κ²½μ£Ό #5920

Open
wants to merge 6 commits into
base: jonghoonok
Choose a base branch
from

Conversation

jonghoonok
Copy link

μ•ˆλ…•ν•˜μ„Έμš”, μ˜€λŠ˜λ„ 리뷰 잘 λΆ€νƒλ“œλ¦½λ‹ˆλ‹€.

random에 λŒ€ν•œ ν…ŒμŠ€νŠΈ μž‘μ„± 등이 μ’€ μ• λ§€ν•΄μ„œ ν…ŒμŠ€νŠΈ μ½”λ“œκ°€ λΆ€μ‘±ν•œ 감이 μžˆλŠ”λ°μš”,
οΏ½ν…ŒμŠ€νŠΈλ₯Ό μ–΄λ–€ μ‹μœΌλ‘œ μž‘μ„±ν•˜λ©΄ 쒋을지 μ€‘μ‹¬μœΌλ‘œ ν”Όλ“œλ°± ν•΄μ£Όμ‹œλ©΄ κ°μ‚¬ν•˜κ² μŠ΅λ‹ˆλ‹€!

theo-94 added 6 commits March 12, 2025 20:17
κΈ°λŠ₯ λͺ©λ‘ 체크리슀트 μž‘μ„±
- 값을 μž…λ ₯λ°›λŠ” UserInputProcessor μž‘μ„±
- 값을 λ‹΄λŠ” UserInput μž‘μ„±
- ν”„λ‘œκ·Έλž¨μ„ μ‹€ν–‰ν•˜λŠ” Main μž‘μ„±
- κ²Œμž„μ„ μ‹€ν–‰ν•˜λŠ” GameController μž‘μ„±
- μœ„μΉ˜λΌλŠ” μƒνƒœμ™€ μƒνƒœλ₯Ό λ³€κ²½ν•˜λŠ” λ©”μ†Œλ“œλ₯Ό κ°–λŠ” Car μž‘μ„±
- Car에 λŒ€ν•œ ν…ŒμŠ€νŠΈ μž‘μ„±
- μž…λ ₯받은 κ°’λ§ŒνΌμ˜ Carλ₯Ό κ°–κ³  이듀을 μ›€μ§μ΄λŠ” CarController μž‘μ„±
- CarController λ‚΄λΆ€μ—μ„œ random을 μ΄μš©ν•˜μ—¬ Carλ₯Ό μ΄λ™μ‹œν‚€λ„λ‘ 함
- Car의 리슀트λ₯Ό λ°›μ•„μ„œ 전체 μžλ™μ°¨μ˜ μƒνƒœλ₯Ό 좜λ ₯ν•˜λŠ” CarPrinter μž‘μ„±
- CarController λ‚΄λΆ€μ—μ„œ CarPrinterλ₯Ό ν˜ΈμΆœν•˜μ—¬ μƒνƒœλ₯Ό 좜λ ₯ν•˜κ²Œ 함
- Car의 리슀트λ₯Ό κ°–λŠ” 1κΈ‰ μ»¬λ ‰μ…˜ Cars μž‘μ„±
- domain, view νŒ¨ν‚€μ§€ 뢄리
Copy link

@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.

3단계 진행 κ³ μƒλ§ŽμœΌμ…¨μŠ΅λ‹ˆλ‹€~
κ°„λ‹¨ν•œ ν”Όλ“œλ°±μ„ λ‚¨κ²ΌμœΌλ‹ˆ ν™•μΈν•΄μ£Όμ„Έμš”!~
μ–Έμ œλ“ μ§€ κΆκΈˆν•œκ²Œ μžˆλ‹€λ©΄ μŠ¬λž™μœΌλ‘œ μ—°λ½μ£Όμ„Έμš”!
ν™§νŒ…μž…λ‹ˆλ‹€!

Comment on lines +8 to +14
private final Cars cars;
private final UserInput userInput;

public CarController(UserInput userInput) {
this.userInput = userInput;
this.cars = new Cars(userInput.getNumOfCar());
}

Choose a reason for hiding this comment

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

MVCνŒ¨ν„΄μ„ κΈ°λ°˜ν•˜μ‹ κ±° κ°™μŠ΅λ‹ˆλ‹€.
ControllerλŠ” κ³Όμ—° μƒνƒœλ₯Ό 가지고 μžˆλŠ”κ²Œ λ§žμ„κΉŒμš”?
즉, μΈμŠ€ν„΄μŠ€λ³€μˆ˜λ‘œ Carsλ₯Ό 가지고 μžˆλŠ”κ²Œ λ§žμ„μ§€... 고민을 ν•΄λ³΄μ‹œλ©΄ μ–΄λ–¨κΉŒμš”?

Comment on lines +6 to +13
public class GameController {
private final UserInputProcessor userInputProcessor = new UserInputProcessor();

public void run() {
UserInput userInput = userInputProcessor.getUserInput();
CarController carController = new CarController(userInput);
carController.race();
}

Choose a reason for hiding this comment

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

Controllerκ°€ Controllerλ₯Ό 가지고 μžˆλŠ” ν˜•νƒœκ°€ MVCμ—μ„œ κΈ°λ°˜λ˜λŠ”κ±ΈκΉŒμš”?

Comment on lines +32 to +34
private boolean isMovable() {
return random.nextInt() > MOVE_THRESHOLD;
}

Choose a reason for hiding this comment

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

μ—¬κΈ°μ„œ λžœλ€μ„ μ œμ–΄ν•œλ‹€λ©΄, Cars에 λŒ€ν•œ moveAll에 λŒ€ν•œ ν…ŒμŠ€νŠΈκ°€ νž˜λ“€κ±° κ°™μŠ΅λ‹ˆλ‹€.

ν•œλ²ˆ μ•„λž˜ 글을 μ°Έκ³ ν•΄λ³΄μ‹œλ©΄ μ–΄λ–¨κΉŒμš”?

https://tecoble.techcourse.co.kr/post/2020-05-17-appropriate_method_for_test_by_interface/

Comment on lines +11 to +25
@ParameterizedTest(name = "μžλ™μ°¨λ₯Ό 움직이면 μžλ™μ°¨κ°€ 움직인 만큼 μœ„μΉ˜κ°€ λ³€ν•œλ‹€. 움직인 κ°’: {0}")
@ValueSource(ints = {1, 2, 3})
void shouldMoveCarByGivenDistance(int inputDistance) {
Car car = new Car();
car.move(inputDistance);
assertThat(car.getDistance()).isEqualTo(inputDistance);
}

@ParameterizedTest(name = "μžλ™μ°¨λ₯Ό 음수만큼 움직이면 μ—λŸ¬κ°€ λ°œμƒν•œλ‹€. 움직인 κ°’: {0}")
@ValueSource(ints = {-1, -2, -3})
void sholdThrowRuntimeExceptionWhenNegativeDistanceIsGiven(int inputDistance) {
Car car = new Car();
assertThatThrownBy(() -> car.move(inputDistance))
.isInstanceOf(RuntimeException.class);
}

Choose a reason for hiding this comment

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

경계값을 ν…ŒμŠ€νŠΈν•΄λΌ. λΌλŠ” 말이 μžˆμŠ΅λ‹ˆλ‹€.
μŒμˆ˜μ™€ μ–‘μˆ˜λ₯Ό 검증해야 ν•˜λŠ”λ°μš”.

κ·Έλ ‡λ‹€λ©΄ μŒμˆ˜μ™€ μ–‘μˆ˜μ˜ 경계선은 μ–΄λ””μΌκΉŒμš”?
-1κ³Ό 1이라고 μƒκ°ν•©λ‹ˆλ‹€.
κ·Έ 두가지 ν…ŒμŠ€νŠΈλ‘œ μΆ©λΆ„νžˆ ν• μˆ˜ μžˆμ§€ μ•Šμ„κΉŒμš”?

1을 κ²€μ¦ν•œλ’€μ— 2,3을 κ²€μ¦ν•˜λŠ”κ²ƒμ— λŒ€ν•΄ 큰 μ˜λ―Έκ°€ μžˆμ„κΉŒμš”?

ν•œλ²ˆ κ³ λ―Όν•΄λ³΄μ‹œλ©΄ 쒋을거 κ°™μŠ΅λ‹ˆλ‹€!

import java.util.Random;
import java.util.function.Consumer;

public class Cars {

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