Open
Conversation
view, controller 및 메세지 다른 파일로 분리
initial page behavior racing-game base behavior racing-game exception behavior
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.
🚗 자동차 경주 게임 (typescript-racingcar)
Demo page
Subject
구현 사항
구현 사항
디렉토리 구조
컴포넌트
컴포넌트 방식으로 문제에 접근했습니다. 복잡한 문제를 작은 단위의 문제로 분리하여 단순화 시켜서 문제를 해결하는게 큰 장점이라고 생각합니다.
cypress
먼저 수정이 있을 때마다, 수동으로 확인하지않고 자동으로 검사해준다는 점이 너무 편했습니다.
BDD방식으로 기능 구현을 하기전에 테스트 코드를 작성했는데, Given, When, Then 으로 작성하려고 했습니다. 동작을 중심으로 먼저 정해놓고 코드를 작성하기 때문에, 한번 테스트 코드를 만들어 놓으면 추가적인 생각없이 정해진 범위 안에서 필요한 기능만 만드는게 큰 장점이라고 생각합니다. 하지만... 쉽지 않았습니다.. 작성하면서 어려움이 있었는데, cypress를 사용하면서 다음과 같은 어려움이 있었습니다.
cypress 문법을 몰라서 반나절을 공식문서를 보며 코드 작성 시작조차 못했는데 이건 경험이 쌓이면 해결될 문제라 생각합니다. 결국 테스트코드를 몰아서 작성했습니다.. 또, 너무 세부적으로 접근해서 방향성을 잃었는데, 앞으로는
describe('racing-game base behavior'...와 같이 전체 큰 주제를 정해놓고it('자동차 이름 입력 했을 때, car name input/button 비활성화'와 같이 테스트 코드를 작성하지 않고 행동만 정의만한 다음 하나씩 테스트 코드 작성 후 실제 코드를 작성하면 전체 주기를 줄일 수 있다고 생각합니다. 좋은 경험이었습니다.고민
HTMLInputElement | null을 반환할 수 있는데, DOM 요소를 가져올때 다음과 같이 강제형변환을 했습니다. DOM을 조작하다보면 null을 반환할 경우도 생길 수 있어서 위험해보입니다. if 문으로if(carNamesInput)null 체크를 해주는 패턴도 있는데 어떤 패턴이 좋은 케이스인지 고민됩니다.