Skip to content

[김기표]로또 2단계 구현완료 리뷰 부탁드립니다. - #10

Open
GiPyoo wants to merge 23 commits into
sproutt:econo-kipyofrom
GiPyoo:newstep02
Open

[김기표]로또 2단계 구현완료 리뷰 부탁드립니다.#10
GiPyoo wants to merge 23 commits into
sproutt:econo-kipyofrom
GiPyoo:newstep02

Conversation

@GiPyoo

@GiPyoo GiPyoo commented Apr 2, 2019

Copy link
Copy Markdown
Member

늦어서 죄송합니다.

Comment thread src/main/java/lotto/domain/Lotto.java Outdated

public boolean isContain(int number) {
return lotto.contains(number);
public boolean isContain(LottoNo number) {

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.

뭘 포함하고 있다는거죠?

Comment thread src/main/java/lotto/domain/Lotto.java Outdated
lotto.stream().forEach(lottoNo -> stringBuilder.append(lottoNo.getNumber() + ", "));
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
stringBuilder.append("]");
return stringBuilder.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.

Builder 패턴과 메소드 체이닝 공부하시고 stringBuilder 다시 써보세요

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.

그리고 정말 toString을 이렇게 구현하시겠습니까?

return winningLottos;
}

public void purchaseMenual(String[] texts) {

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.

text 보다 좋은 네이밍이 있을 것 같습니다


public void purchaseMenual(String[] texts) {
for (String text : texts) {
List<LottoNo> contrivedNumber = Splitter.splitNumber(text);

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.

contrivedNumber 보다 좋은 네이밍이 있을 것 같습니다

List<Integer> randomNumber = generateRandomNumbers();
Collections.sort(randomNumber);
Lotto lotto = new Lotto(randomNumber);
public List<Lotto> purchaseAuto(int money, int numberOfManual) {

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.

어디서는 menual이고 여기서는 manual이고 스펠링이 도대체 뭐죠?

Comment thread src/main/java/lotto/domain/Rank.java Outdated
MISS(0, 0);

private int countOfMatch;
private int winningMoney;

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.

winningPrice

Comment thread src/main/java/lotto/utils/Sorter.java Outdated
list.stream().forEach(number -> lottoNoList.add(new LottoNo(number)));
return lottoNoList;
}
} No newline at end of file

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.

이게 과연 유틸인 것인가.. 고민해볼 필요가 있겠습니다

Comment thread src/test/java/lotto/LottoNoTest.java Outdated
}

@Test
public void 같은지() {

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 boolean isSameRank(Rank rank) {
return this.rank == rank;
}
} No newline at end of file

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.

get set 지워보고 생각해보십쇼 (객체지향 생활체조 규칙 get set 사용을 자제한다)

import java.util.Collections;
import java.util.List;

public class LottoGame {

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.

이 클래스가 너무 무거워보입니다. 너무 많은 책임을 갖고 있는건 아닌지 한번 봐보세요

@hyukjin-lee

Copy link
Copy Markdown
Contributor

가독성을 고려해서 리팩토링 해보세요.

@wijehyeon wijehyeon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DTO개념도 알아보고 리팩토링 해봅시다

return winningLottos;
}

public void purchaseMenual(String[] texts) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

오타입니다

}

public int changeUnit(int totalPrice) {
return totalPrice / 1000;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1000이란 값을 하드코딩중

Comment thread src/main/java/lotto/domain/LottoNo.java Outdated
public LottoNo() {
}

public LottoNo(int number) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

들어오는 number가 1~45의 범위에 해당하는 지,아니라면 에러를 던져주는 것도 이 클래스에 있어야 하지 않을지

@sproutt sproutt deleted a comment from wijehyeon Apr 4, 2019
@GiPyoo

GiPyoo commented Apr 5, 2019

Copy link
Copy Markdown
Member Author

리뷰 반영했습니다. 리뷰 부탁드려요.

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

충분히 더 깔끔하게 잘 할 수 있어보이는데, 시간이 없어보이고 구현에 급급해보인 느낌이 고스란히 담겨있네요. 그래서 리뷰 달기가 꺼려지네요. 레이싱게임에 비해 퇴보하는 듯한 느낌을 받았습니다.

https://github.com/code-squad/java-lotto/blob/javajigi/src/main/java/lotto/LottoGame.java

소스코드 보고 깨달은점이나 느낀점 정리해서 자료실에 제출해주세요. 깨달은 점을 바탕으로 다시 리팩토링 하셔도 됩니다. 대신 해당 부분을 그렇게 리팩토링 한 이유에 대해 설명할 수 있어야합니다. 그리고 강의자료에서 로또 피드백 정독하시고 리팩토링 할 때 반영하세요.

Comment thread src/main/java/lotto/domain/LottoNo.java Outdated
@@ -0,0 +1,21 @@
package lotto.domain;

public class LottoNo {

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.

그렇군요 Number로 바꿔주세요

return new Lotto(randomNumbers);
}

public Lotto auto() {

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.

generateAuto() 가 낫지 않을까요

randomNumbers = new ArrayList<>();
}

public Lotto manual(String continuousNumber) {

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.

generateMenual 이 낫지 않을까요. menual인지 manual인지 통일 시켜달라니까 무시당했네요

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.

4 participants