-
Notifications
You must be signed in to change notification settings - Fork 12
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
[사다리 타기] 안준영 미션 제출합니다. #10
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다. 조언한 부분 수정해서 다시 보내주시면 감사하겠습니다.
궁금한점 답변
- 어느 정도 단위까지 테스트 코드를 작성해야 할지 궁금합니다.
- 어떤 한 로직에 대해서 정상적인 동작과 일어날법한 모든 예외케이스에 대해서 작성하시면 됩니다. 이런 로직 전체를 테스트 코드로 작성하면 되요.
- 테스트 코드 작성법을 공부하고 싶은데 좋은 방법이나 레퍼런스가 있을까요..?
- 사실 테스트 코드를 작성하는 이유는 개발자가 파악 못한 예외를 찾기 위해, 리팩토링하기 위해.. 등등 다양한 이유가 있지만 안정성 있는 로직을 만들기 위해서 인 것 같아요(제 생각)
- 책, 강의도 방법이 될 수 있지만 제가 생각할 때는 실제 프로젝트를 개발할 때 테스트 코드를 작성해 보는 것이에요. 그러면 왜 작성해야하는지.. 더 좋은 방법을 하기위한 방법을 생각할 수 있지 않을까요?
테스트 코드를 작성하면 더 안정성있는, 빠른 코드가 될 수 있지만 필수는 아니라고 생각해요. 실제 많은 스타트업에서도 빠르게 개발하다보니 테스트를 생략하는 경우가 있기도하구요. 하지만 실제로 해보면은 이전보다 더 안정성있게 개발할 수 있어요. 현재 하시는 프로젝트 or 앞으로 할 프로젝트에 적용해보세요!
} | ||
|
||
void createHumans() { | ||
outputView.printNames(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inputview와 outputview의 역할 기준이 모호한 것 같아요.
inputview는 사용자의 입력을 처리하고 그에 맞는 데이터를 포매팅
outputview는 로직을 통해 나온 데이터를 출력하는 용도로 구분하는 것이 더 좋을 것 같아요.
src/main/java/domain/Human.java
Outdated
|
||
public Human(final String name) { | ||
this.name = name; | ||
if (name.length() > 5){throw new IllegalArgumentException("사람 이름은 5글자 이내로 작성해주세요.");} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IllegalArgumentException로 처리한 것도 좋지만 예외에 따라서 IllegalArgumentException를 상속한 예외 클래스를 만들어서 처리하는 방식으로 변경하면 좋을 것 같습니다.
src/main/java/domain/Humans.java
Outdated
return humans; | ||
} | ||
public List<String> getNames(){ | ||
List<String> names = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 코드를 stream으로 리팩토링 할 수 있을 것 같아요.
src/main/java/view/OutputView.java
Outdated
for (String name : names) { | ||
System.out.print(name + Message.SPACE); | ||
} | ||
// System.out.println(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사용 안하는 코드 주석은 삭제하면 좋을 것 같습니다.
src/main/java/view/OutputView.java
Outdated
|
||
public void printLadder(List<List<Boolean>> lines){ | ||
for (List<Boolean> line : lines) { | ||
System.out.print(Message.FIRST_SPACE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
출력 메서드를 매번 하는 것 보다는 문자열 조합을 통해서 하나로 출력하는 것이 성능상 더 좋아요.
src/test/java/domain/LineTest.java
Outdated
@Test | ||
@DisplayName("라인_랜덤_생성") | ||
void Line_랜덤_생성(){ | ||
List<Boolean> points = Arrays.asList(false, true, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asList대신 List.of를 사용해주세요.
궁금한 점
|
어려운 점
궁금한 점