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

Step2 (사다리 생성) : 리뷰 요청드립니다. #413

Merged
merged 28 commits into from
Jun 7, 2020

Conversation

xlffm3
Copy link

@xlffm3 xlffm3 commented Jun 7, 2020

안녕하세요. 피드백을 다음과 같이 반영했습니다.

  1. 상수와 인스턴스 필드의 개행 관련 & 상수 대문자화 : 2f232ec

  2. 커스텀 예외 구현 : df6f938

  3. Line 관련 불필요한 메서드 삭제 및 인터페이스 주입 : cc1bfa7

xlffm3 added 25 commits June 3, 2020 14:04
Copy link

@ssosso ssosso left a comment

Choose a reason for hiding this comment

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

안녕하세요!
사다리 코드를 열심히 깍아주신(?) 느낌이네요 👍
테스트 코드나 코드 퀄러티가 좋습니다. 몇 가지 피드백 드렸으니 확인 부탁드려요~!

Comment on lines 5 to 7
public static final String INVALID_PLAYER_NAME = "게임 참가자의 이름은 빈 문자열이 아닌 1 ~ 5자리의 문자만 가능합니다.";
public static final String INVALID_PLAYER_COUNTS = "게임 참가자는 1명 이상이어야 합니다.";
public static final String INVALID_LADDER_HEIGHT = "사다리 높이는 1 이상이어야 합니다.";
Copy link

Choose a reason for hiding this comment

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

이보다는 RuntimeException을 상속하여 에러를 정의한 클래스를 만들어서 사용해 보면 어떨까요?

Comment on lines 4 to 5

private static final int MINIMUM_LADDER_HEIGHT = 1;
Copy link

Choose a reason for hiding this comment

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

상수는 개행시켜주지 않으셔도 됩니다ㅎㅎ

public class LadderFactory {

private static final int MINIMUM_LADDER_HEIGHT = 1;
private final int ladderHeight;
Copy link

Choose a reason for hiding this comment

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

필드 속성은 상수와 개행시켜 주세요!

Comment on lines 8 to 9
private static final int MINIMUM_PLAYER_COUNTS = 1;
private final List<Point> points;
Copy link

Choose a reason for hiding this comment

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

위의 코멘트와 동일한 컨벤션으로 변경시켜 주세요.

Copy link

Choose a reason for hiding this comment

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

다른 클래스도 모두 변경시켜 주세요!

}
}

private static List<Point> drawLineWithStrategy(int playerCounts,
Copy link

Choose a reason for hiding this comment

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

불필요한 메서드로 보입니다. 이미 클래스로 충분히 설명되는것 같아요.


public static Line drawLine(int playerCounts) {
validatePlayerCounts(playerCounts);
List<Point> points = drawLineWithStrategy(playerCounts, new RandomDrawingLineStrategy());
Copy link

Choose a reason for hiding this comment

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

인터페이스를 생성하신 부분 칭찬드립니다 👍
다만 전략 인터페이스는 조건 + 전략의 조합으로 이루어집니다. 때문에 지금 활용하신 부분은 인터페이스의 활용 정도로 생각해 주세요ㅎㅎ

Copy link

Choose a reason for hiding this comment

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

인터페이스를 활용해 주셨는데 인터페이스의 확장성은 열려있지 않습니다. 외부에서 어떠한 인터페이스를 사용할지 결정시켜 주어야 하는데 파라미터 혹은 생성자 파라미터로 의존성을 열어 주세요.
이와 같은 원리는 스프링의 DI와 일맥상통하니 참고하시기 바랍니다.

private static final int LINE_WIDTH_CONSTANT = 1;
private static final int INDEX_CONSTANT = 1;
private static final int RANDOM_NUMBER_RANGE = 10;
private static final Random random = new Random();
Copy link

Choose a reason for hiding this comment

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

상수라면 변수명이 대문자여야 합니다.

Copy link

@ssosso ssosso left a comment

Choose a reason for hiding this comment

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

리뷰 반영을 잘 해주셨네요 💯
드린 코멘트는 다음 단계에서 부탁드립니다. 머지할게요!


private final List<Line> lines;

private Ladder(List<Line> lines) {
Copy link

Choose a reason for hiding this comment

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

생성자에서 DrawingLineStrategy를 받도록 처리해 주세요. 이렇게 처리해야 확장성이 높아집니다.

@ssosso ssosso merged commit db5769e into next-step:xlffm3 Jun 7, 2020
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