Skip to content

[πŸš€ 사이클2 - λ―Έμ…˜ (λΈ”λž™μž­ κ²Œμž„ μ‹€ν–‰)] 에덴 λ―Έμ…˜ μ œμΆœν•©λ‹ˆλ‹€.#1111

Open
RealTake wants to merge 51 commits intowoowacourse:realtakefrom
RealTake:step2
Open

[πŸš€ 사이클2 - λ―Έμ…˜ (λΈ”λž™μž­ κ²Œμž„ μ‹€ν–‰)] 에덴 λ―Έμ…˜ μ œμΆœν•©λ‹ˆλ‹€.#1111
RealTake wants to merge 51 commits intowoowacourse:realtakefrom
RealTake:step2

Conversation

@RealTake
Copy link

μ•ˆλ…•ν•˜μ„Έμš”, κΈ°λ‘ !

μ£Όμ‹  ν”Όλ“œλ°±μ„ μ—¬λŸ¬ 번 κ³±μ”Ήμ–΄ λ³΄λ©΄μ„œ λ‹€μ–‘ν•œ 방식도 μ‹œλ„ν•΄ 보느라 PRκ³Ό λ‹΅μž₯을 늦게 올리게 λ˜μ–΄ μ£„μ†‘ν•©λ‹ˆλ‹€γ…œγ…œ

ν”Όλ“œλ°±μ„ λ°”νƒ•μœΌλ‘œ λ‹€λ₯Έ 크루뢄듀과도 μ˜κ²¬μ„ λ‚˜λˆ„κ³ , μ—¬λŸ¬ ν¬λ£¨λ“€μ˜ μ½”λ“œλ₯Ό μ‚΄νŽ΄λ³΄λ©΄μ„œ μ œκ°€ 미처 μƒκ°ν•˜μ§€ λͺ»ν–ˆλ˜ λ°©μ‹μ΄λ‚˜ ν‚€μ›Œλ“œλ“€μ„ 많이 μ•Œκ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 덕뢄에 λ§Žμ€ 것을 λ°°μš°λŠ” μ‹œκ°„μ΄ λ˜μ—ˆκ³ , κ·ΈλŸ¬λ‹€ λ³΄λ‹ˆ 일주일이 정말 λΉ λ₯΄κ²Œ μ§€λ‚˜κ°„ 것 κ°™μŠ΅λ‹ˆλ‹€.

특히 μ˜€λžœκΈ°κ°„ κ°œλ°œμ„ ν•΄μ˜€λ©΄μ„œ 주석 λ˜ν•œ κ΄€λ¦¬μ˜ λŒ€μƒμ΄ 될 수 μžˆλ‹€λŠ” 점은 μƒκ°ν•˜μ§€ λͺ»ν–ˆλ˜ 뢀뢄이라 아직도 띡..ν•©λ‹ˆλ‹€..!

PR에 μ•žμ„œ λ‹€μ‹œ 쒋은 ν”Όλ“œλ°± μ£Όμ…”μ„œ λ‹€μ‹œ ν•œ 번 κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€..!

체크 리슀트

  • λ―Έμ…˜μ˜ ν•„μˆ˜ μš”κ΅¬μ‚¬ν•­μ„ λͺ¨λ‘ κ΅¬ν˜„ν–ˆλ‚˜μš”?
  • Gradle testλ₯Ό μ‹€ν–‰ν–ˆμ„ λ•Œ, λͺ¨λ“  ν…ŒμŠ€νŠΈκ°€ μ •μƒμ μœΌλ‘œ ν†΅κ³Όν–ˆλ‚˜μš”?
  • μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ΄ μ •μƒμ μœΌλ‘œ μ‹€ν–‰λ˜λ‚˜μš”?

μ–΄λ–€ 뢀뢄에 μ§‘μ€‘ν•˜μ—¬ 리뷰해야 ν• κΉŒμš”?

  1. 일급 μ»¬λ ‰μ…˜(Players)κ³Ό 수읡 계산 μœ„μΉ˜

상황
사이클 2μ—μ„œ λ°°νŒ… κΈ°λŠ₯이 μΆ”κ°€λ˜λ©΄μ„œ 각 μ°Έκ°€μžμ˜ μˆ˜μ΅μ„ 계산해야 ν•˜λŠ” μš”κ΅¬μ‚¬ν•­μ΄ μƒκ²ΌμŠ΅λ‹ˆλ‹€.
ν˜„μž¬λŠ” BlackjackGame의 calculateAllPlayerRevenue() λ©”μ„œλ“œμ—μ„œ 전체 ν”Œλ ˆμ΄μ–΄μ˜ μˆ˜μ΅μ„ κ³„μ‚°ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

이 κ³Όμ •μ—μ„œ Players λ‚΄λΆ€μ˜ ν”Œλ ˆμ΄μ–΄λ“€μ„ μˆœνšŒν•΄μ•Ό ν•˜κΈ° λ•Œλ¬Έμ— Players.getPlayerList() λ©”μ„œλ“œλ₯Ό λ§Œλ“€κ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

κ³ λ―Ό
getPlayerList()λŠ” λ‚΄λΆ€ μ»¬λ ‰μ…˜μ„ μ™ΈλΆ€λ‘œ λ…ΈμΆœν•˜κ²Œ λ˜λ―€λ‘œ 일급 μ»¬λ ‰μ…˜μ˜ 취지에 λ‹€μ†Œ μ–΄κΈ‹λ‚˜λŠ” 것이 μ•„λ‹Œμ§€ 고민이 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

κ·Έλž˜μ„œ calculateAllPlayerRevenue() λ©”μ„œλ“œλ₯Ό Players λ‚΄λΆ€λ‘œ μ΄λ™μ‹œν‚€λŠ” 것도 ν•˜λ‚˜μ˜ 방법이라고 μƒκ°ν–ˆμŠ΅λ‹ˆλ‹€.
마침 Playerκ°€ betMoney ν•„λ“œλ₯Ό κ°€μ§€κ³  있기 λ•Œλ¬Έμ— Playersκ°€ 각 Playerλ₯Ό μˆœνšŒν•˜λ©° μˆ˜μ΅μ„ κ³„μ‚°ν•˜λŠ” ꡬ쑰도 κ°€λŠ₯ν•΄ λ³΄μž…λ‹ˆλ‹€.

λ‹€λ§Œ 수읡 κ³„μ‚°μ΄λΌλŠ” ν–‰μœ„κ°€ Playerλ‚˜ Playersλ³΄λ‹€λŠ” κ²Œμž„μ˜ κ·œμΉ™κ³Ό 흐름을 λ‹΄λ‹Ήν•˜λŠ” BlackjackGameμ—μ„œ μ²˜λ¦¬ν•˜λŠ” 것이 더 μžμ—°μŠ€λŸ¬μš΄ 것은 아닐지 고민이 λ©λ‹ˆλ‹€.

리뷰 μš”μ²­
1. BlackjackGame이 Players.getPlayerList()둜 μ»¬λ ‰μ…˜μ„ 가져와 μˆœνšŒν•˜λ©΄μ„œ μˆ˜μ΅μ„ κ³„μ‚°ν•˜λŠ” 방식
2. Players 내뢀에 수읡 계산 λ©”μ„œλ“œλ₯Ό 두고 BlackjackGameμ—μ„œλŠ” ν•΄λ‹Ή λ©”μ„œλ“œλ₯Ό 호좜만 ν•˜λŠ” 방식

두 κ°€μ§€ ꡬ쑰 쀑 일급 μ»¬λ ‰μ…˜μ˜ μ˜λ„μ™€ 도메인 μ±…μž„ 뢄리 μΈ‘λ©΄μ—μ„œ μ–΄λ–€ ꡬ쑰가 더 μ μ ˆν• μ§€ 기둠의 μ˜κ²¬μ„ λ“£κ³ μ‹ΆμŠ΅λ‹ˆλ‹€!


2. Service와 Game의 μ—­ν•  경계

상황

blackjackGame에 λŒ€ν•΄μ„œ μ•„λž˜ κ·œμΉ™μ„ μ μš©ν•΄λ³΄λŠ”κ±΄ μ–΄λ–¨κΉŒμš”? getterλ₯Ό μ™œ μ œκ±°ν•˜λΌκ³  ν•˜λŠ”μ§€λ„ μƒκ°ν•΄λ³΄μ‹œμ£ !
객체지ν–₯ μƒν™œ 체쑰 원칙
κ·œμΉ™ 9: κ²Œν„°/μ„Έν„°/ν”„λ‘œνΌν‹°λ₯Ό μ“°μ§€ μ•ŠλŠ”λ‹€.

-> getterλ₯Ό μ œκ±°ν•˜λŠ” λŒ€μ‹  μ„œλΉ„μŠ€κ°€ μ™œ κ²Œν„°λ₯Ό μ‚¬μš©ν•΄μ„œ μ“°κ²Œ λλŠ”μ§€λ₯Ό 보고, κ·Έ 이유λ₯Ό λ‹€μ‹œ gameμ—μ„œ ν•˜λ„λ‘ ν•˜λ‹€λ³΄λ‹ˆ, λŒ€λΆ€λΆ„μ˜ μ„œλΉ„μŠ€ λ‘œμ§λ“€μ΄ Game으둜 μ΄λ™ν•˜κ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ§€κΈˆμ€ Game이 κ²Œμž„ μ§„ν–‰ λ‘œμ§β€μ„, Serviceκ°€ β€œGame 생성 + Game μœ„μž„ + DTO λ³€ν™˜β€μ„ λ§‘κ³  μžˆμŠ΅λ‹ˆλ‹€.

blackJackRule이 λΉ„μ¦ˆλ‹ˆμŠ€ κ·œμΉ™μ— ν•΄λ‹Ήν•˜μ§€ μ•Šμ„κΉŒμš”? κ·Έλ ‡λ‹€λ³΄λ‹ˆ BlackjackGame이 λ‹¨μˆœνžˆ 껍데기 μ—­ν• λ‘œλ§Œ λ°”λ€ŒλŠ”κ²ƒ κ°™λ„€μš”. blackJackGameλ‚΄λΆ€μ—μ„œ μ²˜λ¦¬ν•΄λ³΄λŠ”κ±΄ μ–΄λ–¨κΉŒμš”?
-> λ§ˆμ°¬κ°€μ§€λ‘œ μƒμˆ˜λ§Œ 남겨놓고 각 ν•„μš”ν•œ λ„λ©”μΈμœΌλ‘œ λ©”μŠ€λ“œλ₯Ό μ΄λ™μ‹œμΌ°μŠ΅λ‹ˆλ‹€.

ν˜„μž¬ μ„œλΉ„μŠ€ 클래슀의 역할은 도메인을 직접 μ»¨νŠΈλ‘€λŸ¬μ— λ°˜ν™˜ ν•˜κΈ° 보단 DTOλ₯Ό λ³€ν™˜ν•΄μ„œ μ£ΌλŠ”λ° 의미λ₯Ό λ‘κ³ μžˆμŠ΅λ‹ˆλ‹€.

κ³ λ―Ό
Service의 역할이 DTO λ³€ν™˜κ³Ό blackjackGame.xxx() ν•œ 번만 ν˜ΈμΆœν•˜λŠ” λ‹¨μˆœ μœ„μž„μ΄λΌ, μ²˜μŒλΆ€ν„° μ„œλΉ„μŠ€ λ ˆμ΄μ–΄λ₯Ό 두지 λ§μ•˜μ–΄μ•Ό ν–ˆλ‚˜ μ‹ΆμŠ΅λ‹ˆλ‹€.

리뷰 μš”μ²­

  • μ§€κΈˆ ꡬ쑰λ₯Ό μœ μ§€ν•œ 채 β€œService = μ§„μž…μ  + DTO” μ—­ν• λ§Œ λͺ…μ‹œν• μ§€
  • Service λ ˆμ΄μ–΄λ₯Ό μ œκ±°ν•˜κ³  Controllerκ°€ Game을 직접 μ“Έμ§€

기둠의 μ˜κ²¬μ„ λ“£κ³  μ‹ΆμŠ΅λ‹ˆλ‹€.!

μ‹œκ°„ λ‚΄μ–΄ 리뷰해 μ£Όμ…”μ„œ λ‹€μ‹œ ν•œ 번 κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€..!

wonsang.choi added 30 commits March 4, 2026 17:33
- score() λ©”μ†Œλ“œ μ˜μ‘΄μ„± λ³€κ²½
- controller κΈ°λŠ₯별 λ©”μ†Œλ“œ 뢄리
- dto νŒ¨ν‚€μ§€ λ³€κ²½
wonsang.choi added 21 commits March 10, 2026 13:45
- Deck.cardsν•„λ“œλ₯Ό Set으둜 μ „ν™˜ν•΄μ„œ 쀑볡에 λŒ€ν•œ 문제 λ°©μ§€
- Deck.draw() μ—μ„œ finally 문을 μ‚¬μš©ν•˜λŠ” λŒ€μ‹  μ½”λ“œ νλ¦„μœΌλ‘œ κ°œμ„ 
fix: hit&Stand 둜직 였λ₯˜ μˆ˜μ •
- DefaultBlackjackRule: judgeλ₯Ό Participant 기반으둜 λ³€κ²½, BLACKJACK κ²°κ³Ό μΆ”κ°€
- 각 ν”Œλ ˆμ΄μ–΄ 별 λ°°νŒ… κΈˆμ•‘ μž…λ ₯ λ°›μŒ
Copy link

@Gyuchool Gyuchool left a comment

Choose a reason for hiding this comment

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

μ•ˆλ…•ν•˜μ„Έμš” 에덴
사이클2 λ―Έμ…˜ μ§„ν–‰ν•˜μ‹œλŠλΌ κ³ μƒν•˜μ…¨μŠ΅λ‹ˆλ‹€!! 잘 κ΅¬ν˜„ν•΄μ£Όμ…¨λ„€μš”πŸ‘

λͺ‡ κ°€μ§€ μ½”λ©˜νŠΈλ₯Ό λ‚¨κ²¨λ‘μ—ˆμœΌλ‹ˆ 반영 및 의견 μ£Όμ‹œλ©΄ 쒋을 것 κ°™μŠ΅λ‹ˆλ‹€.πŸ™
κΆκΈˆν•œ 점은 DMμ΄λ‚˜ PR 컀멘트둜 μ–Έμ œλ“ μ§€ μ—¬μ­€λ΄μ£Όμ„Έμš”!

  1. BlackjackGame이 Players.getPlayerList()둜 μ»¬λ ‰μ…˜μ„ 가져와 μˆœνšŒν•˜λ©΄μ„œ μˆ˜μ΅μ„ κ³„μ‚°ν•˜λŠ” 방식
  2. Players 내뢀에 수읡 계산 λ©”μ„œλ“œλ₯Ό 두고 BlackjackGameμ—μ„œλŠ” ν•΄λ‹Ή λ©”μ„œλ“œλ₯Ό 호좜만 ν•˜λŠ” 방식
    두 κ°€μ§€ ꡬ쑰 쀑 일급 μ»¬λ ‰μ…˜μ˜ μ˜λ„μ™€ 도메인 μ±…μž„ 뢄리 μΈ‘λ©΄μ—μ„œ μ–΄λ–€ ꡬ쑰가 더 μ μ ˆν• μ§€ 기둠의 μ˜κ²¬μ„ λ“£κ³ μ‹ΆμŠ΅λ‹ˆλ‹€!

blackJackGame은 μΉ΄λ“œ κ²Œμž„ 진행을 닀루고 μžˆκΈ°μ— 수읡 계산에 λŒ€ν•œ μ±…μž„μ€ λ‹€λ₯Έ 객체에 λ§‘κ²¨λ³΄λŠ”κ±΄ μ–΄λ–¨κΉŒμš”? 리뷰 λ°˜μ˜ν•˜λ©΄μ„œ μ–΄λ–€ 객체가 닀뀄야할지 ν•¨κ»˜ κ°œμ„ ν•΄κ°€λ³΄μ‹œμ£ ..!

Service의 역할이 DTO λ³€ν™˜κ³Ό blackjackGame.xxx() ν•œ 번만 ν˜ΈμΆœν•˜λŠ” λ‹¨μˆœ μœ„μž„μ΄λΌ, μ²˜μŒλΆ€ν„° μ„œλΉ„μŠ€ λ ˆμ΄μ–΄λ₯Ό 두지 λ§μ•˜μ–΄μ•Ό ν–ˆλ‚˜ μ‹ΆμŠ΅λ‹ˆλ‹€.

  • μ§€κΈˆ ꡬ쑰λ₯Ό μœ μ§€ν•œ 채 β€œService = μ§„μž…μ  + DTO” μ—­ν• λ§Œ λͺ…μ‹œν• μ§€
  • Service λ ˆμ΄μ–΄λ₯Ό μ œκ±°ν•˜κ³  Controllerκ°€ Game을 직접 μ“Έμ§€

리뷰에도 λ‚¨κ²ΌλŠ”λ° 저도 λͺ¨ν˜Έν•˜λ‹€κ³  느끼고 μžˆμ–΄μš”πŸ˜Š 에덴은 처음 μ„€κ³„ν• λ•Œ service blackjackGame을 각각 μ–΄λ–€ μ—­ν• λ‘œ ν™œμš©ν•˜λ €κ³  serviceλ₯Ό μΆ”κ°€ν–ˆμ—ˆμ„κΉŒμš”?

}

private boolean hasDuplicatedName(List<String> playerNames) {
return playerNames.size() != playerNames.stream().distinct().count();

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 22
final List<Player> players = playerNames.stream()
.map(Player::new)
.toList();

Choose a reason for hiding this comment

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

player객체 생성 μ±…μž„μ„ BlackjacService보닀 Playersμ—κ²Œ λ„˜κΈ°λŠ”κ±΄ μ–΄λ– μ‹€κΉŒμš”?

Choose a reason for hiding this comment

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

λ”œλŸ¬λ„ λ§ˆμ°¬κ°€μ§€λ‘œ μ μ ˆν•œ κ³³μ—μ„œ 객체 μƒμ„±ν•˜λ©΄ 쒋을 것 κ°™λ„€μš”:)

Comment on lines +49 to +56
private int readPlayerBattingMoneyRetry(String playerName) {
int battingMoney = -1;

while (battingMoney <= 0) {
battingMoney = readPlayerBattingMoney(playerName);
}
return battingMoney;
}

Choose a reason for hiding this comment

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

do-while문을 ν™œμš©ν•˜λ©΄ μ–΄λ–¨κΉŒμš”? μ§€κΈˆμ€ -1의 의미λ₯Ό ν•΄μ„ν•˜κΈ° μ–΄λ ΅λ„€μš”..!

import team.blackjack.view.OutputView;

public class BlackJackController {
private final BlackJackService blackJackService;

Choose a reason for hiding this comment

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

에덴이 μƒκ°ν•˜μ‹œκΈ°μ— blackJackController와 blackJackService의 각각 역할이 λ¬΄μ—‡μΌκΉŒμš”?
ν˜„μž¬λŠ” 둜직이 Controller에 더 λ§Žμ€ 것 같은데 μ–΄λ–»κ²Œ μƒκ°ν•˜μ‹€κΉŒμš”?

OutputView.printAskDrawCard(playerName);
String hitYn = InputView.readHitDecision();

while (!"y".equalsIgnoreCase(hitYn) && !"n".equalsIgnoreCase(hitYn)) {

Choose a reason for hiding this comment

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

"y","n"이 λ°˜λ³΅λ˜λŠ” μƒμˆ˜λ‘œ κ΄€λ¦¬ν•˜λŠ”κ±΄ μ–΄λ– μ‹€κΉŒμš”?

public void drawInitialCards() {
this.players.initPlayerHands(deck);

this.dealer.hit(dealer.draw(deck));

Choose a reason for hiding this comment

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

Suggested change
this.dealer.hit(dealer.draw(deck));
this.dealer.hit(deck.draw());

μ΄λ ‡κ²Œλ„ κ΅¬ν˜„ν•  수 μžˆμ„ 것 같은데 dealer.draw()λ©”μ„œλ“œλ₯Ό λ§Œλ“  μ΄μœ κ°€ μžˆμ„κΉŒμš”?

Comment on lines +43 to +49
private double calculateMoney(Player player) {
final Result result = judge(player);
return result.getOdds() * player.getBatMoney();
}

private Result judge(Player player) {
if (player.isBust()) {

Choose a reason for hiding this comment

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

점수 계산 및 νŒλ‹¨ν•˜λŠ” λ‘œμ§μ€ μ€‘μš”ν•œ λ‘œμ§μΈλ°μš”. ν…ŒμŠ€νŠΈκ°€ κ°€λŠ₯ν•œ ꡬ쑰가 μ•„λ‹Œκ²ƒ κ°™λ„€μš”..! μ μ ˆν•œ κ°μ²΄μ—κ²Œ μ±…μž„μ„ λ„˜κ²¨λ³΄λŠ”κ±΄ μ–΄λ–¨κΉŒμš”?


public List<Integer> getScore() {
return this.number.score;
public Set<Integer> getScore() {

Choose a reason for hiding this comment

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

Set자료ꡬ쑰 ν™œμš©πŸ‘

Comment on lines +12 to +16
public Dealer dealer;
public Player pobi;
public Player jason;
public Players players;
public BlackjackGame game;

Choose a reason for hiding this comment

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

public일 ν•„μš”κ°€ μžˆμ„κΉŒμš”?

public class Player extends Participant {
private final String name;
private final List<Hand> hands;
private double batMoney;

Choose a reason for hiding this comment

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

κ·œμΉ™ 3: λͺ¨λ“  μ›μ‹œκ°’κ³Ό λ¬Έμžμ—΄μ„ 포μž₯ν•œλ‹€.

λ°°νŒ…κΈˆμ•‘μ΄ μŒμˆ˜κ°€ μ•ˆλ˜λ„λ‘ viewμ—μ„œ 잘 λ§‰μœΌμ…¨μ–΄μš”..!πŸ‘
λ‹€λ§Œ, λ°°νŒ… κΈˆμ•‘μ΄ μŒμˆ˜κ°€ μ•ˆλ˜λŠ”κ±΄ 도메인 κ·œμΉ™μ— ν•΄λ‹Ήλœλ‹€κ³  μƒκ°ν•˜λŠ”λ° λ„λ©”μΈμ—μ„œλ„ κ²€μ¦ν•˜λŠ”κ±΄ μ–΄λ– μ‹€κΉŒμš”?

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