Repository navigation
Step6 pr 보냅니다. - #119
Merged
Merged
Step6 pr 보냅니다.#119
Conversation
javajigi
suggested changes
Oct 18, 2018
|
|
||
| public AbstractFigure(ArrayList<Point> points) { | ||
| AbstractFigure(List<Point> points) { | ||
| this.points = points; |
Contributor
There was a problem hiding this comment.
figureException() 처리를 이 생성자에서 처리하도록 구현하고 자식 생성자에서 figureException()를 호출하지 않도록 구현해 본다.
|
|
||
| public interface FigureCreator { | ||
| AbstractFigure create(ArrayList<Point> points); | ||
| AbstractFigure create(List<Point> points); |
| resultView.displayResult(FigureFactory.create(points)); | ||
| } | ||
|
|
||
| @Test(expected = IllegalArgumentException.class) |
javajigi
suggested changes
Oct 19, 2018
| @Override | ||
| public double area() { | ||
| return points.get(0).calculateLIne(points.get(1)); | ||
| return super.points.get(0).calculateLIne(super.points.get(1)); |
Contributor
There was a problem hiding this comment.
부모 클래스의 points를 protected -> private으로 구현
다음과 같은 메소드를 통해 데이터 접근해 본다.
protected Point get(int index) {
retrun points.get(index);
}
위와 같은 메소드를 통해 접근할 것을 추천. 데이터 전체를 노출하지 않도록 한다.
그리고 특별한 이유가 없는 super를 쓰지 않는다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
인터페이스에 대해 고민 하고 pr 보냅니다. 좀더 객체 지향적인 사고를 해보려 노력했으나 변경할게 생각이 잘 안났습니다. ArraysList 를 List 로 바꾸고 Resultview에서 figure.area()와 figure.name()을 출력하도록 코드를 수정했습니다.
그리고 exception 태스트 코드를 추가했습니다.