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

[1단계 - 자동차 경주 구현] 병민(윤병인) 미션 제출합니다. #93

Merged
merged 38 commits into from
Feb 17, 2022

Conversation

airman5573
Copy link

어제 계산기 미션을 늦게까지 하느라 자동차 경주를 너무 늦게 시작했습니다.
그래서 이번 미션은 시간내에 완수하지 못했습니다.

페어프로그래밍을 통해서도 많이 배웠습니다.
감사합니다 :D

index.html Outdated
<h1 class="text-center">🏎️ 자동차 경주 게임🏁</h1>
<p>5자 이하의 자동차 이름을 콤마로 구분하여 입력해주세요.</p>
</section>
<section class="mb-5">
Copy link

Choose a reason for hiding this comment

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

Suggested change
<section class="mb-5">
<section class="mb-5">
<p>5자 이하의 자동차 이름을 콤마로 구분하여 입력해주세요.</p>

html 영역을 그룹핑할 때 그 안에 들어가는 요소들의 스타일이 동일한 경우 대체로 자식요소들이 동일한 위치에 있도록 하는게 좋아요.

마찬가지로 입력 필드에 대한 설명(또는 제목), 입력 필드, 버튼을 section 태그로 그룹핑했을 때, 자동차 이름 입력 필드 섹션과 시도 횟수 입력 필드 섹션에 자식 요소들이 동일하게 위치 하는게 더 일관성있는 코드가 되지 않을까요?

그리고 p태그보다 더 웹표준에 적합한, 입력 필드의 설명 또는 제목을 나타낼 수 있는 태그가 무엇일까요?

Copy link
Author

Choose a reason for hiding this comment

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

  1. 네, 이해했습니다. 수정하겠습니다.
  2. p태그보다 label이 더 적합해보입니다.

index.html Outdated
<button id="car-names-button" type="button" class="btn btn-cyan">확인</button>
</div>
</section>
<section id="racing-count-form" hidden>
Copy link

Choose a reason for hiding this comment

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

hidden attribute를 사용하셨군요~ 👍 👍

padding-top: 10px;
padding-left: 30px;
padding-right: 30px;
padding-bottom: 7px;
Copy link

Choose a reason for hiding this comment

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

상하좌우 4방향 모두 padding을 주는 경우 shorthand properties(약식)으로 작성해 볼 수도 있겠어요~

Copy link
Author

Choose a reason for hiding this comment

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

네, 수정하겠습니다.

CAR_RACING_STATUS: '.car-racing-status',
};

export const GAME = {
Copy link

Choose a reason for hiding this comment

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

GAME 보다 좀 더 구체적인 상수명을 지어주는게 더 좋을 것 같아요~ 구성된 값들이 어떤것을 지칭 하는지 좀 더 생각해보면 좋겠네요!

Copy link
Author

Choose a reason for hiding this comment

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

네, 더 고민해보겠습니다.

MIN_INPUT_COUNT: 1,
};

export const ERR_MESSAGE = {
Copy link

Choose a reason for hiding this comment

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

가급적이면 단어를 줄이지 말고 작성하는것을 좀 더 추천합니다 🙂

Copy link
Author

Choose a reason for hiding this comment

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

네, 알겠습니다.

src/js/index.js Outdated

export default function racingCarGame() {
init();
}
Copy link

@glassyi glassyi Feb 12, 2022

Choose a reason for hiding this comment

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

지금은 어디서 racingCarGame 모듈을 가져와서 쓰는 코드가 없어서 racingCarGame를 export해서 쓰려는 이유가 궁금하네요~ 😅

Copy link
Author

Choose a reason for hiding this comment

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

앗, 수정하겠습니다

return name.length >= MIN_CAR_NAME_LENGTH;
}

function isValidCarNames(carNames) {
Copy link

Choose a reason for hiding this comment

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

isValidCarNames 함수가 현재 예외 조건 체크와 에러메세지를 보여주는 역할을 다 가지고 있는데요. 예외 조건 체크하는 함수와 에러메세지 처리 함수로 역할을 분리시켜보는게 어떨까요?

Copy link
Author

Choose a reason for hiding this comment

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

동감합니다.

혹시

function isValid(~) {
	~~~
	return {
		hasError: false,
		message: ~~~
	}
}
const { hasError, message } = isValid(~);
if (hasError) {
	alert(message);
	return;
}

이런 방식은 어떨까요?

Copy link

Choose a reason for hiding this comment

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

오 네~ 이런 방식도 괜찮습니다. 👍 여기서 추가로 제안을 해보자면 carName은 결국 MIN_CAR_NAME_LENGTH 이상이고 MAX_CAR_NAME_LENGTH 이하인 조건을 둘다 충족해야 하는거 아닐까요? 이 때 사용자에게 두개의 케이스를 안내할 수 있는 적절한 메세지 하나로 변경한다면 isValidCarNames 함수는 더 간결해 질 것 같은데 어떤가요?

import startRacingGame from '../game/startRacingGame.js';
import $ from '../utils/dom.js';

function isValidRacingCount(racingCount) {
Copy link

Choose a reason for hiding this comment

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

링크
동일한 코멘트 내용이라 링크로 남겨놓아요~

@@ -0,0 +1,7 @@
export function hideElement(element) {
return element.setAttribute('hidden', true);
Copy link

Choose a reason for hiding this comment

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

hidden attribute로 처리하는 방식 좋습니다 👍

cy.get(SELECTORS.CAR_NAMES_BUTTON)
.click()
.then(() => {
expect(alertStub).to.be.called;
Copy link

Choose a reason for hiding this comment

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

alert이 호출되었는지 작성해주셨군요~ 여기에 추가로 유효하지 않은 조건에 부합하는 에러메세지와 alert 메세지가 일치하는지도 시나리오를 추가하면 더 좋을 것 같습니다!

Copy link
Author

Choose a reason for hiding this comment

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

네, 수정하겠습니다

export const cars = [];

export function makeObjectCars(carNames) {
carNames.forEach((name) => cars.push(new Car(name)));
Copy link

@glassyi glassyi Feb 12, 2022

Choose a reason for hiding this comment

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

cars가 모듈로서 직접적으로 외부에서 쓰이면 관리하기가 어려워집니다. 어디서 변경될지 모르기 때문이죠. 그래서 이런 경우 보통은 객체나 클래스로 감싸서(데이터 캡슐화라고 하죠) 그 객체가 스스로 데이터를 자율적으로 관리하도록 해요. 그러면 외부에서 데이터를 쓰기 위해서는 그 데이터를 관리하는 객체를 통해서만 접근이 가능하기 때문에 어디서 어떻게 변경되는지 예측하기 쉬워집니다.

cars와 cars를 변경하는 makeObjectCars 메소드를 가지는 객체 또는 클래스를 만들어 적용해보세요~
추가로 makeObjectCars 네이밍도 좀 더 고민해보시면 좋겠네요~ 🙂

Copy link
Author

Choose a reason for hiding this comment

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

네, 더 고민해보겠습니다.

Copy link

@glassyi glassyi left a comment

Choose a reason for hiding this comment

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

병민님 안녕하세요! 리뷰를 맡게된 율리라고 합니다~ 😀

이전 미션을 수행하느라 이번 미션에서 시간이 부족 하셨나봐요.
그래도 여기까지 오느라 고생 많으셨습니다!

다음 스텝 또는 미션에서는 요구사항에 대한 기능구현에 목표를 두고 미션에 임해보셔요.
이번엔 아쉽게도 기능구현이 다 되어 있지 않아서 우선 작성해 주신 코드에서
코멘트 드릴 수 있는 내용으로 리뷰드려요~

우선 style을 구조적으로 잘 분리해 놓은 부분이 눈에 띄었습니다.
그리고 css 파일들이 대부분 마지막 줄에 new line 추가가 안되어 있더라구요. 수정 요청드려요!

전반적으로 디테일한 리뷰 내용은 코멘트로 달아두었으니 참고해 주세요~
보시면서 반영할 수 있는 부분들 위주로 개선해 보시면 좋을 것 같습니다.
확인 부탁드려요~! 🙂

document에서부터 싹 검색해서 찾는것보다 빠르다
@glassyi glassyi merged commit 4953ab5 into woowacourse:airman5573 Feb 17, 2022
@glassyi
Copy link

glassyi commented Feb 17, 2022

이번 스텝 바로 머지하고 다음 스텝에서 추가 커밋들에 대한 리뷰를 같이 진행할게요~! 스텝2에서 뵈어요! 😀

@airman5573
Copy link
Author

이번 스텝 바로 머지하고 다음 스텝에서 추가 커밋들에 대한 리뷰를 같이 진행할게요~! 스텝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.

2 participants