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

[사다리 타기] 안준영 미션 제출합니다. #10

Open
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

Junyeong-An
Copy link

어려운 점

  • 테스트 코드 작성이 익숙치 않아 어려웠습니다 TDD가 잘 이루어지지 않은 것 같아 아쉬웠습니다.
  • 일급 컬렉션이라는 새로운 개념을 알게 되어 사용하는데 어려웠습니다.

궁금한 점

  • 어느 정도 단위까지 테스트 코드를 작성해야 할지 궁금합니다.
  • 테스트 코드 작성법을 공부하고 싶은데 좋은 방법이나 레퍼런스가 있을까요..?

Copy link
Collaborator

@HanHyunsoo HanHyunsoo left a 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();
Copy link
Collaborator

Choose a reason for hiding this comment

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

inputview와 outputview의 역할 기준이 모호한 것 같아요.

inputview는 사용자의 입력을 처리하고 그에 맞는 데이터를 포매팅

outputview는 로직을 통해 나온 데이터를 출력하는 용도로 구분하는 것이 더 좋을 것 같아요.


public Human(final String name) {
this.name = name;
if (name.length() > 5){throw new IllegalArgumentException("사람 이름은 5글자 이내로 작성해주세요.");}
Copy link
Collaborator

Choose a reason for hiding this comment

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

IllegalArgumentException로 처리한 것도 좋지만 예외에 따라서 IllegalArgumentException를 상속한 예외 클래스를 만들어서 처리하는 방식으로 변경하면 좋을 것 같습니다.

return humans;
}
public List<String> getNames(){
List<String> names = new ArrayList<>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 코드를 stream으로 리팩토링 할 수 있을 것 같아요.

for (String name : names) {
System.out.print(name + Message.SPACE);
}
// System.out.println();
Copy link
Collaborator

Choose a reason for hiding this comment

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

사용 안하는 코드 주석은 삭제하면 좋을 것 같습니다.


public void printLadder(List<List<Boolean>> lines){
for (List<Boolean> line : lines) {
System.out.print(Message.FIRST_SPACE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

출력 메서드를 매번 하는 것 보다는 문자열 조합을 통해서 하나로 출력하는 것이 성능상 더 좋아요.

@Test
@DisplayName("라인_랜덤_생성")
void Line_랜덤_생성(){
List<Boolean> points = Arrays.asList(false, true, false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

asList대신 List.of를 사용해주세요.

@Junyeong-An
Copy link
Author

Junyeong-An commented May 24, 2024

  • 시간내서 리뷰남겨주셔서 감사합니다..! 남겨주신 리뷰보고 수정해보았습니다.
  • .asList,List.of의 반환 리스트는 java.util.ArrayList가 아니다라는 사실을 새로 알게 되었습니다. 찾아보면서 불변 객체의 중요성을 더 알게되었습니다.
  • InputView:
    • 사용자에게 입력을 받기 전에 안내 메시지를 출력하도록 변경했습니다.
    • 입력된 데이터를 적절한 형식으로 변환하여 반환했습니다.
  • OutputView:
    • 로직을 통해 생성된 데이터를 출력하게했습니다.
    • 출력 형식을 지정하고, 출력된 데이터를 문자열로 반환하도록 했습니다.

궁금한 점

  • 테스트 케이스를 더 추가할 부분이 있는지 궁금합니다.
  • 수정사항의 mvc패턴이 잘 지켜졌는지 궁금합니다.

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