Skip to content

[자동차경주] 이정민 미션 제출합니다#5

Open
piamin04 wants to merge 4 commits into
Java-JavaScript-Language-Stuty:mainfrom
piamin04:main
Open

[자동차경주] 이정민 미션 제출합니다#5
piamin04 wants to merge 4 commits into
Java-JavaScript-Language-Stuty:mainfrom
piamin04:main

Conversation

@piamin04

Copy link
Copy Markdown

No description provided.

구현 기능 목록 작성
자동차 이름 검수 및 쉼표를 기준으로 나누는 함수 작성
시도할 횟수 받기 만약 횟수가 0이하이면 오류
@piamin04 piamin04 closed this Feb 14, 2025
@piamin04 piamin04 reopened this Feb 14, 2025
@piamin04 piamin04 changed the title [2주차 미션 제출] 자동차 경주 게임 [자동차경주] 이정민 미션 제출합니다 Feb 14, 2025

@seulnan seulnan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

너무 고생많으셨습니다!

전체적으로 피드백할 부분이 조금 있어요!

  1. MVC패턴을 도입하고 자바의 유용한 api을 적극활용한다면 유지보수 프로세스를 이해하는데 도움될 것 같아용
  2. 단순히 에러메시지를 "error"로 하기보다 [ERROR] 자세한에러메시지(ex. 특수문자는 입력할 수 없습니다) 같이 자세하게 적어준다면 더 가독성 좋은 코드가 될 듯 해요
  3. 커밋컨벤션이나 pr의 description을 적극활용하여 리뷰어들에게 더 좋은 리뷰를 받아보는 건 어떨까용??

그리고.. 이건 좀 살짝 사적인 느낌이 있긴한데 정민이가 매니징이 어려워서, 개발에 대해 잘 몰라서, 뭐라도 도전하고싶은 마음에 이 스터디를 하는걸로 알아요 너무 대단하고 존경해요👏🏻👏🏻

갠적으로 PO나 PM은 개발을 이해할 때 단순히 특정 프로그래밍 언어나 API에 대한 지식보다, 아키텍처, 코드품질, 유지보수 면에서 아는게 많은 것이 후어어얼씬 중요하다고 생각해요. (컨벤션도 협업을 편하게 하기위해서 + 유지보수 면에서 활용가능하기때문에 하는 면이 있습니당)

유지보수& 구현하는 데의 난이도를 판별하게 된다면, 매니징 할 때 업무분배나 기한을 잡는것도 잘 되고 또는 기획을 할 때도 너무 규모있는 서비스를 기획했다가 시행착오가 일어나지않게 된다고해야하나..?

다음부터는 정민이도 파일분리나 유지보수와 가독성도 신경써보고 유용한 API가 있다면 사용도 해본다면 분명 서비스의 구현&유지보수 난이도도 파악하게 되고, 매니징도 감을 잡아갈 거라 믿어용 너무 응원해요 정민쓰 🔥 🔥

}

// 자동차 이동 및 출력
public static void print(List<String> carList, int[] carDistances) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

여기에서 자동차 이동여부를 결정하는 로직과 출력을 동시에 처리하고있어서 이를 분리한다면 유지보수에 더 좋을 것 같아요!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

보통 출력과 로직은 분리하는 편이 좋습니당!!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 말에 적극 동의해요! 모든 로직과 입출력을 하나의 폴더도 아닌 파일에 다 넣다보면 코딩하는 중간에도 자신이 적은 코드들이 어디에 위치해 있는지 헷갈리고 그게 나중에는 오류로 이어지는 경우가 많더라고요...

public static class Play {
// 자동차 이동 여부 결정
public static boolean isMovable() {
return Randoms.pickNumberInRange(0, 9) >= 4;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이것두 이렇게 하드코딩대신 상수를 적극 활용하는것도 유지보수성을 높이는데 좋아요!

List<String> carNames = Car.cut(input);
int carNamesSize = carNames.size();

//시도할 횟수 받기

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

여기에 숫자가 아닌 입력이 들어올때 예외를 발생시키는 코드도 넣으면 좋을것같아용

throw new IllegalArgumentException("error");
}

List<String> carList = new ArrayList<>(Arrays.asList(input.split(",")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

carName 에 trim을 적용하고 이를 return하는 기존 리스트 carList 에 다시 적용해야하는데 그 코드가 빠져있어서 오류의 가능성이 있어보여용 (일종의 복사본처럼 작동하는 carName에만 적용한거죠!) 기존리스트 전체를 변경하는 replaceAll 을 활용해서 고쳐보는 건 어떨까요?

return carList;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

한 파일에 한 class만 존재하도록 파일을 분리하는게 더 좋아보여요!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

동의합니다! 아니면 스크롤을 열심히 내려야하고 코드 찾기도 어렵더라구요..1학년때 1파일 2만자 코딩을 해본적 있는데 지옥이었습니다


//자동차 생성 및 이름 리스트로 저장 및 배열 크기 구하기
List<String> carNames = Car.cut(input);
int carNamesSize = carNames.size();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

변수선언 없이 carNames.size()만 사용하는게 더 좋아보입니다...!

}

//자동차가 움직이는 횟수 저장하는 int형 배열 생성
int[] carDistances = new int[carNamesSize];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

변수는 윗쪽에 한번에 모아서 선언해주는게 나을것같아요

}
if (carName.length() > 5) {
throw new IllegalArgumentException("error");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if(carName.length()<0 || carNames.length()>5) 로 한번에 써주는게 더 보기 편할 것 같습니다!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

동의합니다~~ 저렇게 한번에 쓰는게 컴파일러가 돌아갈때도 좀더 효율적인 방법이라구 알고있습니다!

@Regyung Regyung left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

코드를 리뷰하면서 꼭 한 번 적용시켜 보셨으면 하는 것들이 있었어요.

  1. MVC 패턴 활용해보기
  2. README 작성을 통해 머릿속에 큰 틀을 짜고 시작해보기
    해보시면 코딩이 이전보다 수월해 질 거예요~ 2주차도 수고하셨습니다!

Comment thread README.md
자동차의 수가 4이상이면 -출력하고 자동차가 얼마나 움직이는지를 저장하는 int형 변수에 +1하기
반환 : 1등 자동차 이름

5. 결과 출력 No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

가능하다면 README 작성을 통해서 실제 코딩에 들어가기 전 머릿속에 전체적인 코드 구조를 생각하며 빠르게 구현할 수도 있어요. 단순히 과제에 나온 설명을 적는 것 말고도 실제 필요할 듯한 함수나 클래스들을 미리 구상하면서 간단한 설명과 함께 README에 적고 시작하면 훨씬 수월할 거예요!

}

// 자동차 이동 및 출력
public static void print(List<String> carList, int[] carDistances) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 말에 적극 동의해요! 모든 로직과 입출력을 하나의 폴더도 아닌 파일에 다 넣다보면 코딩하는 중간에도 자신이 적은 코드들이 어디에 위치해 있는지 헷갈리고 그게 나중에는 오류로 이어지는 경우가 많더라고요...

}

//자동차가 움직이는 횟수 저장하는 int형 배열 생성
int[] carDistances = new int[carNamesSize];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

자동차가 움직이는 횟수나 이름을 자동차 Class에 하나의 요소로 넣어서 따로 배열을 만들어서 관리하는 것보다 객체들로 관리하는게 더 편하고 나을 것 같아요!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

저도 동의합니다~~ 그렇게 하지 않으면 추후(이건 미션이라 하진 않지만 현업에서는) 유지보수할 때 car 관련을 수정할 때 main과 car를 전부 봐야해서 불편할 수도 있을 것 같아용

@daeGULLL daeGULLL left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

주석을 많이 달아두셔서 이해하기 편한 코드였습니다!!! 저는 귀찮아서 잘 달지 않는 편이었는데 덕분에 중요성을 깨달았습니다..달아야겠다 다음번에는 MVC 패턴도 도입해보시는거 추천해요 코드 분리 연습에 도움 됩니다!!

그리고 난슬씨 리뷰를 읽었는데 매니징 하기 위해 이런 공부까지 하시다니...정말 대단해요...정말 수고하셨고 앞으로도 같이 수고합시당~~!!

}
if (carName.length() > 5) {
throw new IllegalArgumentException("error");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

동의합니다~~ 저렇게 한번에 쓰는게 컴파일러가 돌아갈때도 좀더 효율적인 방법이라구 알고있습니다!

}

//자동차가 움직이는 횟수 저장하는 int형 배열 생성
int[] carDistances = new int[carNamesSize];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

저도 동의합니다~~ 그렇게 하지 않으면 추후(이건 미션이라 하진 않지만 현업에서는) 유지보수할 때 car 관련을 수정할 때 main과 car를 전부 봐야해서 불편할 수도 있을 것 같아용

return carList;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

동의합니다! 아니면 스크롤을 열심히 내려야하고 코드 찾기도 어렵더라구요..1학년때 1파일 2만자 코딩을 해본적 있는데 지옥이었습니다

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.

5 participants