Skip to content

Conversation

Hoya-kim
Copy link

안녕하세요!
김정호입니다🙇🏻‍♂️

저는 이지인님과 함께 연료주입, 블랙잭 미션을 수행했습니다!
리뷰 주시면 피드백 반영하겠습니다!

항상 좋은 리뷰 감사합니다!😄

Hoya-kim and others added 30 commits February 11, 2022 16:15
연료 주입 미션 요구 사항 정리
- 기능 요구 사항
- 프로그래밍 요구 사항
- 기능 구현 사항 리스트 정리
- Avante, K5, Sonata 클래스 생성
- 제공된 테스트 코드 추가
- constructor
- getDistancePerLiter()
- getTripDistance()
- getName()
- 기능 구현 사항 리스트 완료 처리
- 블랙잭 게임 기능 구현 사항 작성
classes
- BlackjackGame
- Dealer
- Deck
- Denomination
- Gambler
- Judgement
- InputView
- OutputView
- Player
- Suit
classes
- DealerTest
- DeckTest
- DenominationTest
- GamblerTest
- JudgementTest
- PlayerTest
- SuitTest
- 기능 구현 완료 사항 체크 표시
- enum타입의 suit, denomination값을 가지는 Card class 설계
- deck class 구현
- field : List card
- method: setupCard, setDenomination, shuffle, popCard
- 중복 코드 제거를 위함
- Dealer#allocateCard 메서드 구현
- calculateScore
- adjustScore
Copy link

@joswlv joswlv left a comment

Choose a reason for hiding this comment

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

안녕하세요 정호님!
유연하고 읽기 좋은 코드를 위해 객체 관계를 고민해주세요 🙇
몇 가지 코멘트를 남겼습니다. 확인부탁드립니다.

return denomination;
}

public String getDenomiationCountstring() {
Copy link

Choose a reason for hiding this comment

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

Suggested change
public String getDenomiationCountstring() {
public String getDenomiationCountString() {

Comment on lines +19 to +20
List<Player> players = playersName.stream().map(Player::new)
.collect(Collectors.toList());
Copy link

Choose a reason for hiding this comment

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

Suggested change
List<Player> players = playersName.stream().map(Player::new)
.collect(Collectors.toList());
Players players = playersName.stream().map(Player::new)
.collect(Collectors.toList());

로또 미션에서 학습한 것 처럼 일급컬렉션을 만들어 객체의 행위를 정해보면 어떨까요?

Comment on lines +18 to +19
private final int count;
private final String countString;
Copy link

Choose a reason for hiding this comment

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

Suggested change
private final int count;
private final String countString;
private final int score;
private final String cardName;

의미를 명확하게 변수명을 변경해보는 것은 어떨까요?

import java.util.ArrayList;
import java.util.List;

public class Player {
Copy link

Choose a reason for hiding this comment

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

플레이어에게 카드를 받을 수 있는지 여부를 판단하는 역할을 추가하면 어떨까요?

@@ -0,0 +1,29 @@
package blackjack.domain;

public class Card {
Copy link

Choose a reason for hiding this comment

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

매 게임마다 카드를 새로 생성해야하는 것 보다 카드 static하게 만들어 보는 것은 어떨까요?

import java.util.List;
import java.util.stream.Collectors;

public class BlackjackGame {
Copy link

Choose a reason for hiding this comment

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

컨트롤러에 카드점수 상태를 판단하는 로직이 있는 것 보다 적절한 객체에 책임을 부여해보는 것은 어떨까요?
딜러와 플레이어가 카드를 들고 있는 손을 객체로 만들어 카드를 추가 여부와 카드를 카드 점수 상태를 관리해 보는 것은 어떨까요?

public Deck() {
cards = new ArrayList<>();
setupCard();
shuffle();
Copy link

Choose a reason for hiding this comment

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

덱을 구성하는 방식을 주입받아 생성하는 것은 어떨까요?

private static void printFinalResult(Map<String, String> results) {
System.out.println(FINAL_RESULT);
results.forEach((name, result) -> {
System.out.println(name + COLON + result);
Copy link

Choose a reason for hiding this comment

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

Suggested change
System.out.println(name + COLON + result);
privat static final String FINAL_RESULT_MESSAGE = "%s : %s";
...
System.out.println(String.format(FINAL_RESULT_MESSAGE, name, result));

+연산자 보다 String.format을 활용해 보는 것은 어떨까요?

@@ -0,0 +1,39 @@
package blackjack.domain;

public class Dealer extends Player {
Copy link

Choose a reason for hiding this comment

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

딜러와 플레이어의 공통행위를 추상화해보는 방식으로 수정하면 어떨까요?
딜러와 플레이어 모두 카드를 받는 행위와 이름을 가지고 있습니다.

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