Skip to content

Step6 pr 보냅니다. - #119

Merged
javajigi merged 10 commits into
code-squad:jar100from
jar100:step6
Oct 21, 2018
Merged

javajigi merged 10 commits into
code-squad:jar100from
jar100:step6

Conversation

@jar100

@jar100 jar100 commented Oct 18, 2018

Copy link
Copy Markdown

인터페이스에 대해 고민 하고 pr 보냅니다. 좀더 객체 지향적인 사고를 해보려 노력했으나 변경할게 생각이 잘 안났습니다. ArraysList 를 List 로 바꾸고 Resultview에서 figure.area()와 figure.name()을 출력하도록 코드를 수정했습니다.
그리고 exception 태스트 코드를 추가했습니다.

@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.

구현 잘 했네요. 테스트 코드도 👍
피드백 좀 남겨 봅니다.


public AbstractFigure(ArrayList<Point> points) {
AbstractFigure(List<Point> points) {
this.points = 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.

figureException() 처리를 이 생성자에서 처리하도록 구현하고 자식 생성자에서 figureException()를 호출하지 않도록 구현해 본다.


public interface FigureCreator {
AbstractFigure create(ArrayList<Point> points);
AbstractFigure create(List<Point> 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.

Figure로 반환해 구현한다.

resultView.displayResult(FigureFactory.create(points));
}

@Test(expected = IllegalArgumentException.class)

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.

Exception 테스트 👍

@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.

상속을 제대로 이해하기 위한 마지막 연습

@Override
public double area() {
return points.get(0).calculateLIne(points.get(1));
return super.points.get(0).calculateLIne(super.points.get(1));

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를 protected -> private으로 구현
다음과 같은 메소드를 통해 데이터 접근해 본다.

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

위와 같은 메소드를 통해 접근할 것을 추천. 데이터 전체를 노출하지 않도록 한다.
그리고 특별한 이유가 없는 super를 쓰지 않는다.

@javajigi
javajigi merged commit 9c3dd61 into code-squad:jar100 Oct 21, 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