[자동차 경주] 남지윤 미션 제출합니다.#1
Open
yuninam2128 wants to merge 13 commits into
Open
Conversation
문자열과 숫자를 입력받는 기능을 추가하였다.
쉼표를 기준으로 이름을 구분하는 문자열 전처리 기능을 추가하였다.
랜덤값을 활용해 전진/멈춤을 판별하고, 자동차별 전진 수를 카운트하는 기능을 추가하였다.
'-'를 카운트 횟수만큼 반복 출력해 실행 결과를 출력하는 기능을 추가하였다.
문제에서 제시하는 조건에 일치하도록 출력 기능을 수정하였다.
전진 수를 비교하여 우승자 이름을 출력하는 기능을 추가하였다.
중복, 조건에 어긋나는 입력, 빈 문자열을 처리하는 기능을 추가하였다.
중복 코드를 함수로 만드는 등 코드를 간결하게 개선하였다.
App.js, Model.js, View.js 추가, MVC 패턴으로 수정하였다.
예외처리 관련 테스트 게이스를 추가하였다.
| }); | ||
| }); | ||
| }); | ||
|
|
There was a problem hiding this comment.
아 테스트 코드를 작성한다는 게 무슨 뜻인지 몰랐는데 이렇게 하는거군요,,,
참고하겠습니다
| } | ||
|
|
||
| export default View; | ||
|
No newline at end of file |
There was a problem hiding this comment.
MVC 패턴으로 깔끔하게 구분하셔서 좋은 것 같습니다
근데 궁금한 점이 있다면, 기본 Console 라이브러리로 수행할 수 있는 작업들을 View 클래스를 새로 생성해서 다시 기능을 정의하면 어떤 이점이 있는지 궁금합니다
MVC 패턴을 아직 제대로 모르는 입장에서 보면 이 파일이 왜 필요할까..? 라는 생각이 들어서요!
| if (Random.pickNumberInRange(0, 9) >= 4) { | ||
| this.count++; | ||
| } | ||
| } |
There was a problem hiding this comment.
만약 가독성, 유지보수 측면을 더 고려할 수 있다면
숫자 4나 9같은 매직 넘버를 상수로 정의하는 방법도 있습니다!
ex)
const BASELINE = 4;
const MAX_RANDOM_NUMBER = 9;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
피드백이 필요한 부분
고려한 예외