Conversation
연료 주입 미션 요구 사항 정리 - 기능 요구 사항 - 프로그래밍 요구 사항 - 기능 구현 사항 리스트 정리
Classes - Car - RentCompany
- 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
classes -Card
- allocateCard()
- Denomination
- 기능 구현 완료 사항 체크 표시
-Suit
- enum타입의 suit, denomination값을 가지는 Card class 설계
- deck class 구현 - field : List card - method: setupCard, setDenomination, shuffle, popCard
- 중복 코드 제거를 위함 - Dealer#allocateCard 메서드 구현
- calculateScore - adjustScore
-addOneMoreCard
-addOneMoreCard
-addOneMoreCard
- findWinner()
- findWinner() - checkWinOrLost() - getDealerResult() - getCount()
- testFindWinner
joswlv
left a comment
There was a problem hiding this comment.
안녕하세요 정호님!
유연하고 읽기 좋은 코드를 위해 객체 관계를 고민해주세요 🙇
몇 가지 코멘트를 남겼습니다. 확인부탁드립니다.
| return denomination; | ||
| } | ||
|
|
||
| public String getDenomiationCountstring() { |
There was a problem hiding this comment.
| public String getDenomiationCountstring() { | |
| public String getDenomiationCountString() { |
| List<Player> players = playersName.stream().map(Player::new) | ||
| .collect(Collectors.toList()); |
There was a problem hiding this comment.
| List<Player> players = playersName.stream().map(Player::new) | |
| .collect(Collectors.toList()); | |
| Players players = playersName.stream().map(Player::new) | |
| .collect(Collectors.toList()); |
로또 미션에서 학습한 것 처럼 일급컬렉션을 만들어 객체의 행위를 정해보면 어떨까요?
| private final int count; | ||
| private final String countString; |
There was a problem hiding this comment.
| 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 { |
There was a problem hiding this comment.
플레이어에게 카드를 받을 수 있는지 여부를 판단하는 역할을 추가하면 어떨까요?
| @@ -0,0 +1,29 @@ | |||
| package blackjack.domain; | |||
|
|
|||
| public class Card { | |||
There was a problem hiding this comment.
매 게임마다 카드를 새로 생성해야하는 것 보다 카드 static하게 만들어 보는 것은 어떨까요?
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| public class BlackjackGame { |
There was a problem hiding this comment.
컨트롤러에 카드점수 상태를 판단하는 로직이 있는 것 보다 적절한 객체에 책임을 부여해보는 것은 어떨까요?
딜러와 플레이어가 카드를 들고 있는 손을 객체로 만들어 카드를 추가 여부와 카드를 카드 점수 상태를 관리해 보는 것은 어떨까요?
| public Deck() { | ||
| cards = new ArrayList<>(); | ||
| setupCard(); | ||
| shuffle(); |
| private static void printFinalResult(Map<String, String> results) { | ||
| System.out.println(FINAL_RESULT); | ||
| results.forEach((name, result) -> { | ||
| System.out.println(name + COLON + result); |
There was a problem hiding this comment.
| 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 { | |||
There was a problem hiding this comment.
딜러와 플레이어의 공통행위를 추상화해보는 방식으로 수정하면 어떨까요?
딜러와 플레이어 모두 카드를 받는 행위와 이름을 가지고 있습니다.
안녕하세요!
김정호입니다🙇🏻♂️
저는 이지인님과 함께 연료주입, 블랙잭 미션을 수행했습니다!
리뷰 주시면 피드백 반영하겠습니다!
항상 좋은 리뷰 감사합니다!😄