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단계 - 자동차 경주 #5053

Open
wants to merge 12 commits into
base: areumj0507
Choose a base branch
from
Open

Conversation

areumj0507
Copy link

  • 단위 테스트 구현
  • 자바 코드 컨벤션 유지
  • else 사용 지양

단위 테스트를 구현하는 데 어려움이 있네요😅
코멘트 및 피드백 부탁드립니다!

@csh0034 csh0034 self-requested a review November 9, 2023 03:43
Copy link

@csh0034 csh0034 left a comment

Choose a reason for hiding this comment

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

3단계 구현하시느라 수고많으셨습니다.
몇가지 코멘트 남겨두었는데 확인후에
다시 리뷰요청 부탁드려요!

private static final String NUMBER = "number";
private static final String COUNT = "count";

public static Map<String, Integer> inputResult() {
Copy link

Choose a reason for hiding this comment

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

Map 이 꼭 필요한 형태가 아닌것 같아요 🥲

자동차대수를 입력받는메서드와 횟수를 입력받는 메서드 두가지로 나누면 좋을것 같습니다

private static final String NUMBER = "number";
private static final String COUNT = "count";

public static void start() {
Copy link

Choose a reason for hiding this comment

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

사용하고 있지 않네요!

import java.util.Map;
import java.util.Random;

public class CarRacingMain {
Copy link

Choose a reason for hiding this comment

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

메인 메서드가 없어서 실행결과를 확인할수가없네요 🥲
추가후에 요구사항에 맞춰 실행결과를 볼수있도록 구현부탁드립니다


import java.util.Map;

public class ResultView {
Copy link

Choose a reason for hiding this comment

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

과정을 진행하면서 Map 과 배열은 사용하지 않는걸 추천드립니다.

String[][] 2차원배열의 경우엔 현재 각 어떤값이 들어가있는지 코드를 다 따라가서 확인하지 않으면
이해하기 어려운것 같아요.

필요하다면 별도 DTO 등의 형태로 클래스를 만들어보시면 좋을것 같습니다.

public void testConcat() {
ResultView.concat(0, 0, "-");
ResultView.concat(1, 0, "");
assertThat(ResultView.value()[1][0]).isEqualTo("-");
Copy link

Choose a reason for hiding this comment

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

만약 출력시 대쉬가 아닌 * 을 사용해야한다면 테스트코드 자체가 변경되어야하는구조입니다.
테스트코드와 객체(도메인) 는 출력에 의존적이지 않은 형태로 고민해보시면 좋을것 같습니다.

@csh0034
Copy link

csh0034 commented Nov 9, 2023

추가적으로 코멘트 남깁니다.

현재 코드가 객체지향적이지 않고 메서드만 존재하여 절차지향적으로 작성되어있습니다.
요구사항으로부터 어떤 도메인(객체) 가 존재하는지 파악한후에 해당 객체에 상태(필드)와 행위(메서드)를 부여해보면 좋을것 같아요.

힌트를 드리자면 자동차의 움직인 거리 를 표현해야하므로
Car 라는 객체가 distance 또는 position 등의 상태를 가져야겠죠!
또한 이동 이라는 행위와 조건에 따라 거리를 증가 시키는 행위가 포함될것 같습니다.

객체지향적설계와 요구사항의 내용들은 모두 구현해보시는데 초점을 맞춰보시면 좋을것 같습니다.
궁금하신 사항있으시면 편하게 DM 주세요!

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