-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
박스터 좋은데요?
이상한 점 찾아내느라 힘들었어욧
public enum ErrorCode { | ||
DUPLICATE_NAME, | ||
RESERVED_NAME, | ||
NOT_EXIST_MESSAGE, | ||
BLANK_NAME, | ||
EMPTY_CARD, | ||
INVALID_COMMAND, | ||
INVALID_MONEY_UNIT, | ||
INVALID_MONEY_BOUND, | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
신기한데요?
패키지는 어디에 위치할지 고민해보시면 좋을 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
패키지 나누기 힘들어요 팁 주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어떤 문제를 해결하고 있는지에 대해서 적으래요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그게 무슨 말인데요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
에러코드가 메시지를 가지는것에 대해서는 어떻게 생각하시나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Choi-JJunho 일관성 있게 view 에서 메세지를 다 관리하고 싶었습니다.
private BlackjackGame createBlackjackGame() { | ||
Participants participants = createParticipants(); | ||
return new BlackjackGame(participants); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BlackjackGame(List<String> playerNames) 같은 형태는 어떤가요?
바깥에서 생성할 이유가 없어보여요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞는 말 입니다
private Participants createParticipants() { | ||
try { | ||
List<String> names = inputView.readNames(); | ||
return Participants.from(names); | ||
} catch (CustomException e) { | ||
outputView.printError(e.getErrorCode()); | ||
return createParticipants(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
재귀보다는 while 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그거 쓸 줄 몰라요.. 알려주세요
public static String convert(Card card) { | ||
return CardNumberMessage.from(card.getNumber()).getMessage() + | ||
CardSuitMessage.from(card.getSuit()).getMessage(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 클래스는 CardNumberMessage 에 들어가면 어떨까요?
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view 가 domain 을 필드로 가지고 있다면, 도메인에 너무 세부사항에 의존하게 되는 것 같아요
domain 을 필드에서 빼보는건 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view가 도메인을 의존하면 안되는 이유가 있을까요? view 주제에
public Card(CardSuit cardSuit, CardNumber cardNumber) { | ||
this.cardSuit = cardSuit; | ||
this.cardNumber = cardNumber; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new 로 생성할 수 있는데, 캐싱을 하는 의미가 없어보여요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
죄송합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
왜 의미가 없죠?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
생성자 막아놓고 정적 팩터리로 이미 만들어놓은거 반환해주면 될라나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그죠 그러면 되죠
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
캐싱 좋은데요?
public List<Card> toList() { | ||
return List.copyOf(cards); | ||
} |
There was a problem hiding this comment.
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 = "딜러"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected 변수는 안좋은 것 같아요
웨인지는 궁금하면 월요일날....
말로하기 길어요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
글로 적기 긴거 아닌가요? 근데 리뷰어가 이렇게 하라던데 궁금합니다 눈우 박사
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
말랑이 이거 괜찮데요
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); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getter 는 equalsHashcode 밑에!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나는 위에 놓고 싶던데
public Map<Player, Money> getBettingResults() { | ||
return Map.copyOf(bettingResults); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 순서 보장 안되는거 아시죠?
혹시나해서 말씀드려요><@
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅋㅋ 어쩐지 출력이 지멋대로 되더라고요 ㅋㅋ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LinkedHashMap이던가 그런거 순서 되는것도 있으요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나머지는 고기먹고 와서 남기겟슴다
from. 깃짱코딩
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원 이하만 입력 가능합니다."), | ||
; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메세지 패키지는 무엇을 하는 아이인가여??
승
, 패
, 무
는 view
의 역할인 것 같기도 한데
뷰에서 하기 너무 복잡해지는 것들을 모아놓는 보조 뷰...?
public Card(CardSuit cardSuit, CardNumber cardNumber) { | ||
this.cardSuit = cardSuit; | ||
this.cardNumber = cardNumber; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
왜 의미가 없죠?
public Card(CardSuit cardSuit, CardNumber cardNumber) { | ||
this.cardSuit = cardSuit; | ||
this.cardNumber = cardNumber; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
생성자 막아놓고 정적 팩터리로 이미 만들어놓은거 반환해주면 될라나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
박스터 안녕하세요~
전체적으로 좋은 리뷰가 달려있어 궁금한 내용 위주로 코멘트 남겼습니다~
public enum ErrorCode { | ||
DUPLICATE_NAME, | ||
RESERVED_NAME, | ||
NOT_EXIST_MESSAGE, | ||
BLANK_NAME, | ||
EMPTY_CARD, | ||
INVALID_COMMAND, | ||
INVALID_MONEY_UNIT, | ||
INVALID_MONEY_BOUND, | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
에러코드가 메시지를 가지는것에 대해서는 어떻게 생각하시나요?
BlackjackGame blackjackGame = createBlackjackGame(); | ||
start(blackjackGame); | ||
printResult(blackjackGame); |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
equalsIgnoreCase 좋은데요?
public Card(CardSuit cardSuit, CardNumber cardNumber) { | ||
this.cardSuit = cardSuit; | ||
this.cardNumber = cardNumber; | ||
} |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this를 붙이는 기준이 있을까요?
아래에는 없네요?
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한장만 가져오는데 List일 이유가 있나요?
No description provided.