Skip to content

[Team8] Lotto Step1 입니다. #15

Open
urbanscenery wants to merge 6 commits into
wwh-techcamp-2018:team8_pair1from
Woowahan2nd8:step1
Open

[Team8] Lotto Step1 입니다. #15
urbanscenery wants to merge 6 commits into
wwh-techcamp-2018:team8_pair1from
Woowahan2nd8:step1

Conversation

@urbanscenery
Copy link
Copy Markdown

8조 코드리뷰 부탁드립니다.

Copy link
Copy Markdown
Contributor

@javajigi javajigi left a comment

Choose a reason for hiding this comment

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

전체적으로 구현은 잘 했어요. 단, 결과 처리를 담당하는 객체를 하나 더 추가하면 어떨까라는 의견과 enum 사용에 대해 좀 더 고민해 보면 좋겠네요.

Comment thread src/main/java/Todo.md
- 1) 로또결과 (로또 객체와 완전 상관없는 부분) 따로 빼고 클라이언트에서 호출
- 2) 네이밍
- 3) 유틸
- 4) 접근 제어 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.

todo list 작성 💯


public class HitNumber {
final List<Integer> hitNumbers;
static final String DELIMITER = ", ";
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.

클래스의 구현 순서는 다음과 같다. 다음 원칙에 따라 구현한다.

class A {
    상수(static final) 또는 클래스 변수
    인스턴스 변수
    생성자
    메소드
}

try {
num = toInt(number);
} catch (NumberFormatException e) {
return false;
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.

이 부분은 굳이 try/catch로 처리하지 않아도 되지 않을까?
그냥 exception throw하도록..
좀 과하다는 느낌이 듦


import java.util.List;

public class Lotto {
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.

HitNumber와의 차이점은??
같은 Lotto로 사용해도 되지 않나?

resultAwardMap.put(3, basicAwards.getThree_correct());
resultAwardMap.put(4, basicAwards.getFour_correct());
resultAwardMap.put(5, basicAwards.getFive_correct());
resultAwardMap.put(6, basicAwards.getSix_correct());
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.

convention 위반
변수 이름, 메소드 이름에 "_"를 사용하지 않는다.
camel 컨벤션을 따른다.


public static int maxLottoToBuy(Money money) {
return money.getMoney() / LOTTO_PRICE;
}
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.

수익률을 계산하고 결과 처리를 담당하는 새로운 객체를 추가하는 것은 어떨까?
LottoClient가 너무 많은 일을 하고 있는 것 같다.

resultAwardMap.put(6, basicAwards.getSix_correct());
}

private enum LOTTO_AWARDS {
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.

enum을 적절하게 사용하지 못하고 있는 느낌이다.
enum을 어떤 용도로 사용할 것인지 좀 더 고민해 보면 좋겠다.


public int getMoney() {
return money;
}
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.

Money가 더 많은 일을 할 수 있지 않을까?
몇 장의 Lotto를 구매할 수 있는지, 수익율 등도 이곳에서 처리할 수 있지 않을까?
돈과 관련된 모든 로직을 구현한다면??


@Test
public void 로또구입금액딱맞음() {
assertThat(LottoClient.maxLottoToBuy(new Money(5000))).isEqualTo(5);
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.

로또갯수와 같은 TestCase 아닌가?

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.

3 participants