Skip to content

Step5 - #113

Merged
javajigi merged 4 commits into
code-squad:jar100from
jar100:step5
Oct 17, 2018
Merged

Step5#113
javajigi merged 4 commits into
code-squad:jar100from
jar100:step5

Conversation

@jar100

@jar100 jar100 commented Oct 16, 2018

Copy link
Copy Markdown

step5 pr 보냅니다 피드백 부탁드려요

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

객체에 인스턴스 변수를 너무 많이 생성하지 않으면 좋을 것 같네요.
피드백 좀 남겼어요.

protected String name;
protected ArrayList<Point> points;
protected int size;
protected double result;

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의 모든 인스턴스 변수를 private으로 구현한다.

public abstract class Figure {
protected String name;
protected ArrayList<Point> points;
protected int size;

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.

name과 size의 경우 인스턴스 변수 대신 추상 메소드로 구현해 본다.

toDo.put(T, new Triangle(points).calculate());
toDo.put(TWO, new Line(points).area());
toDo.put(FOUR, new Rectangle(points).area());
toDo.put(T, new Triangle(points).area());

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을 생성해야 하기 때문에 성능이 떨어질 것 같다.
매번 Map을 생성하지 않도록 구현할 수는 없을까?

다음과 같은 힌트를 준다면 도움이 좀 될까요?

public interface FigureCreator {
    Figure create(List<Point> points);
}

@javajigi
javajigi merged commit 24edc48 into code-squad:jar100 Oct 17, 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