Skip to content

submit step5 1st - #116

Merged
javajigi merged 2 commits into
code-squad:kkssryfrom
kkssry:step5
Oct 18, 2018
Merged

javajigi merged 2 commits into
code-squad:kkssryfrom
kkssry:step5

Conversation

@kkssry

@kkssry kkssry commented Oct 16, 2018

Copy link
Copy Markdown

지저분한거 다시 만들었습니다.

@javajigi javajigi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

상속을 통해 구현이 많이 깔끔해 졌네요. 👍
피드백 남겨 봅니다.

map.put(2, new Line(points));
map.put(3, new Triangle(points));
map.put(4, new Rectangle(points));
return map.get(points.size()).toString();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

이렇게 되면 points 크기가 2인 경우에도 모든 도형을 생성하지 않을까요?
성능 이슈도 있고, 뭔가 맞는 구조는 아니라는 생각이 드네요.

예를 들어 다음과 같은 인터페이스를 만들고 이에 대한 각각의 구현체를 Figure 구현체에서 생성하도록 한다면..

public interface FigureMessage {
  String outputMessage();
}


public List<Point> getPoints() {
return points;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

이와 같이 전체 데이터를 공개하기 보다 다음과 같은 메소드면 충분하지 않을까?

protected Point getPoint(int index) {
    return points.get(index);
}

접근 제어자도 꼭 필요한 범위로 한정하도록 한다.

@javajigi javajigi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Factory 인터페이스 추가 및 테스트 코드 구현 잘 했네요. 💯

@javajigi
javajigi merged commit abe4eb2 into code-squad:kkssry Oct 18, 2018
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