Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

늦어서 죄송합니다 박스터 입니다 #15

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

drunkenhw
Copy link
Member

No description provided.

@drunkenhw drunkenhw changed the title 늦어서 죄송합니다 늦어서 죄송합니다 박스터 입니다 Mar 12, 2023
Copy link

@be-student be-student left a comment

Choose a reason for hiding this comment

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

박스터 좋은데요?
이상한 점 찾아내느라 힘들었어욧

Comment on lines 3 to 12
public enum ErrorCode {
DUPLICATE_NAME,
RESERVED_NAME,
NOT_EXIST_MESSAGE,
BLANK_NAME,
EMPTY_CARD,
INVALID_COMMAND,
INVALID_MONEY_UNIT,
INVALID_MONEY_BOUND,
;

Choose a reason for hiding this comment

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

신기한데요?
패키지는 어디에 위치할지 고민해보시면 좋을 것 같아요

Copy link
Member Author

Choose a reason for hiding this comment

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

패키지 나누기 힘들어요 팁 주세요

Choose a reason for hiding this comment

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

어떤 문제를 해결하고 있는지에 대해서 적으래요

Copy link
Member Author

Choose a reason for hiding this comment

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

그게 무슨 말인데요

Choose a reason for hiding this comment

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

에러코드가 메시지를 가지는것에 대해서는 어떻게 생각하시나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Choi-JJunho 일관성 있게 view 에서 메세지를 다 관리하고 싶었습니다.

Comment on lines +32 to +35
private BlackjackGame createBlackjackGame() {
Participants participants = createParticipants();
return new BlackjackGame(participants);
}

Choose a reason for hiding this comment

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

BlackjackGame(List<String> playerNames) 같은 형태는 어떤가요?
바깥에서 생성할 이유가 없어보여요

Copy link
Member Author

Choose a reason for hiding this comment

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

맞는 말 입니다

Comment on lines +76 to +84
private Participants createParticipants() {
try {
List<String> names = inputView.readNames();
return Participants.from(names);
} catch (CustomException e) {
outputView.printError(e.getErrorCode());
return createParticipants();
}
}

Choose a reason for hiding this comment

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

재귀보다는 while 어떤가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

그거 쓸 줄 몰라요.. 알려주세요

Comment on lines +7 to +11
public static String convert(Card card) {
return CardNumberMessage.from(card.getNumber()).getMessage() +
CardSuitMessage.from(card.getSuit()).getMessage();
}
}

Choose a reason for hiding this comment

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

이 클래스는 CardNumberMessage 에 들어가면 어떨까요?

Comment on lines +12 to +24
ACE(CardNumber.ACE, "A"),
TWO(CardNumber.TWO, "2"),
THREE(CardNumber.THREE, "3"),
FOUR(CardNumber.FOUR, "4"),
FIVE(CardNumber.FIVE, "5"),
SIX(CardNumber.SIX, "6"),
SEVEN(CardNumber.SEVEN, "7"),
EIGHT(CardNumber.EIGHT, "8"),
NINE(CardNumber.NINE, "9"),
TEN(CardNumber.TEN, "10"),
JACK(CardNumber.JACK, "J"),
QUEEN(CardNumber.QUEEN, "Q"),
KING(CardNumber.KING, "K");

Choose a reason for hiding this comment

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

view 가 domain 을 필드로 가지고 있다면, 도메인에 너무 세부사항에 의존하게 되는 것 같아요
domain 을 필드에서 빼보는건 어떤가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

view가 도메인을 의존하면 안되는 이유가 있을까요? view 주제에

Comment on lines +20 to +23
public Card(CardSuit cardSuit, CardNumber cardNumber) {
this.cardSuit = cardSuit;
this.cardNumber = cardNumber;
}

Choose a reason for hiding this comment

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

new 로 생성할 수 있는데, 캐싱을 하는 의미가 없어보여요

Copy link
Member Author

Choose a reason for hiding this comment

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

죄송합니다

Copy link
Collaborator

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
왜 의미가 없죠?

Copy link
Collaborator

Choose a reason for hiding this comment

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

생성자 막아놓고 정적 팩터리로 이미 만들어놓은거 반환해주면 될라나요?

Choose a reason for hiding this comment

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

그죠 그러면 되죠

Choose a reason for hiding this comment

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

캐싱 좋은데요?

Comment on lines +65 to +67
public List<Card> toList() {
return List.copyOf(cards);
}

Choose a reason for hiding this comment

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

모든 게 다 방어적 복사네요
꼼꼼한사람...

import java.util.List;

public abstract class Participant {
protected static final String DEALER_NAME = "딜러";

Choose a reason for hiding this comment

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

protected 변수는 안좋은 것 같아요
웨인지는 궁금하면 월요일날....
말로하기 길어요

Copy link
Member Author

Choose a reason for hiding this comment

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

글로 적기 긴거 아닌가요? 근데 리뷰어가 이렇게 하라던데 궁금합니다 눈우 박사

Choose a reason for hiding this comment

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

말랑이 이거 괜찮데요

Comment on lines +21 to +40
public String getValue() {
return value;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Name name = (Name) o;
return Objects.equals(value, name.value);
}

@Override
public int hashCode() {
return Objects.hash(value);
}

Choose a reason for hiding this comment

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

getter 는 equalsHashcode 밑에!

Copy link
Collaborator

Choose a reason for hiding this comment

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

나는 위에 놓고 싶던데

Comment on lines 19 to 21
public Map<Player, Money> getBettingResults() {
return Map.copyOf(bettingResults);
}

Choose a reason for hiding this comment

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

이거 순서 보장 안되는거 아시죠?
혹시나해서 말씀드려요><@

Copy link
Member Author

Choose a reason for hiding this comment

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

ㅋㅋ 어쩐지 출력이 지멋대로 되더라고요 ㅋㅋ

Copy link
Collaborator

Choose a reason for hiding this comment

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

LinkedHashMap이던가 그런거 순서 되는것도 있으요

Copy link
Collaborator

@gitchannn gitchannn left a comment

Choose a reason for hiding this comment

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

나머지는 고기먹고 와서 남기겟슴다

from. 깃짱코딩

Comment on lines 11 to 19
DUPLICATE_NAME(ErrorCode.DUPLICATE_NAME, "중복된 이름은 사용할 수 없습니다."),
RESERVED_NAME(ErrorCode.RESERVED_NAME, "이름은 딜러일 수 없습니다"),
NOT_EXIST_MESSAGE(ErrorCode.NOT_EXIST_MESSAGE, "해당 메세지가 없습니다."),
BLANK_NAME(ErrorCode.BLANK_NAME, "이름은 공백일 수 없습니다."),
EMPTY_CARD(ErrorCode.EMPTY_CARD, "뽑을 수 있는 카드가 없습니다."),
INVALID_COMMAND(ErrorCode.INVALID_COMMAND, "Y 또는 N을 입력해주세요."),
INVALID_MONEY_UNIT(ErrorCode.INVALID_MONEY_UNIT, "금액은 1000원 단위로 입력 가능합니다."),
INVALID_MONEY_BOUND(ErrorCode.INVALID_MONEY_BOUND, "금액은 10,000,000원 이하만 입력 가능합니다."),
;
Copy link
Collaborator

Choose a reason for hiding this comment

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

ㅇㅈ요 저도 ErrorCode에 필드로 관리하거나 하는게 더 좋을 것 같다고 생각함다

@@ -0,0 +1,42 @@
package blackjack.view.message;
Copy link
Collaborator

Choose a reason for hiding this comment

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

메세지 패키지는 무엇을 하는 아이인가여??
, , view의 역할인 것 같기도 한데
뷰에서 하기 너무 복잡해지는 것들을 모아놓는 보조 뷰...?

Comment on lines +20 to +23
public Card(CardSuit cardSuit, CardNumber cardNumber) {
this.cardSuit = cardSuit;
this.cardNumber = cardNumber;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
왜 의미가 없죠?

Comment on lines +20 to +23
public Card(CardSuit cardSuit, CardNumber cardNumber) {
this.cardSuit = cardSuit;
this.cardNumber = cardNumber;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

생성자 막아놓고 정적 팩터리로 이미 만들어놓은거 반환해주면 될라나요?

Copy link

@Choi-JJunho Choi-JJunho left a comment

Choose a reason for hiding this comment

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

박스터 안녕하세요~
전체적으로 좋은 리뷰가 달려있어 궁금한 내용 위주로 코멘트 남겼습니다~

Comment on lines 3 to 12
public enum ErrorCode {
DUPLICATE_NAME,
RESERVED_NAME,
NOT_EXIST_MESSAGE,
BLANK_NAME,
EMPTY_CARD,
INVALID_COMMAND,
INVALID_MONEY_UNIT,
INVALID_MONEY_BOUND,
;

Choose a reason for hiding this comment

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

에러코드가 메시지를 가지는것에 대해서는 어떻게 생각하시나요?

Comment on lines +27 to +29
BlackjackGame blackjackGame = createBlackjackGame();
start(blackjackGame);
printResult(blackjackGame);

Choose a reason for hiding this comment

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

너무 간결해서 좋은데요?

if (PLAY.command.equalsIgnoreCase(command)) {
return PLAY;
}
if (STOP.command.equalsIgnoreCase(command)) {

Choose a reason for hiding this comment

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

equalsIgnoreCase 좋은데요?

Comment on lines +20 to +23
public Card(CardSuit cardSuit, CardNumber cardNumber) {
this.cardSuit = cardSuit;
this.cardNumber = cardNumber;
}

Choose a reason for hiding this comment

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

캐싱 좋은데요?

}

public boolean isAce() {
return this.cardNumber.isAce();

Choose a reason for hiding this comment

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

this를 붙이는 기준이 있을까요?
아래에는 없네요?

Choose a reason for hiding this comment

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

페어탓 해명하세요

Map<Player, Money> bettingResults = bets.keySet().stream()
.collect(Collectors.toMap(
player -> player,
player -> bets.get(player).multiply(blackjackResult.get(player).getRatio()),

Choose a reason for hiding this comment

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

.이 너무 많네요..
디미터의 법칙 위배아닐까요?
변수로 추출해주면서 어떤 값인지 표현하면 읽기 편할것 같아요

.collect(Collectors.toMap(
player -> player,
player -> bets.get(player).multiply(blackjackResult.get(player).getRatio()),
(o1, o2) -> o1,

Choose a reason for hiding this comment

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

o1, o2? 무슨의미죠?
근데 저도 이렇게 썼던거 같네요
죄송합니다

if (score.equals(dealerScore)) {
return GameResult.TIE;
}
if (score.isGreaterOrEqualsTo(dealerScore)) {

Choose a reason for hiding this comment

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

좋은데요?

}

public int getTieCount() {
return Collections.frequency(blackjackResult.values(), GameResult.TIE);

Choose a reason for hiding this comment

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

Collections.frequency 좋은데요?

}

public List<Card> getFirstCard() {
return List.of(getAllCards().get(0));

Choose a reason for hiding this comment

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

한장만 가져오는데 List일 이유가 있나요?

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