Skip to content

Conversation

@OHHAKO
Copy link
Member

@OHHAKO OHHAKO commented Jan 6, 2020

self feedback 4 + 2 question
-four Self feedback -

  1. programmer should've decide to detail policy
    because given blackjack rule is so simple and not enough
    (especially policy about betting money)
    so consider how can we handle the game 'Rule' before make code

  2. follow the programming rules
    i know it's hard to do but really helpful to make clean and readable code

  3. keep chasing the efficient code and get confidence
    rush to code with confidence attitude but don't forget it;s not perfect

  4. get feedback and please edit your code
    i think this is the good way to better level

-two question -

  1. final로 선언된 변수의 값을 변경하고 싶을때 어떻게 처리하시나요?
    how do you handle the params that defined as final?

Player 클래스에서 List 타입으로 선언된 cards의 경우는
클래스 메서드에서 list.add 함수를 이용해 객체를 하나씩 추가하는게 가능했습니다.
그러나 int, double과 같은 변수들은 추가의 개념이 아니라 '값의 변경'이 일어나서
get,set 메서드를 사용해야 했습니다.
값 변경을 위해 저는 final로 선언된 bettingMoney에서 final을 지워버렸네요...

  1. business logic & UI logic 분리
    지난 과제에서 business logic과 UI logic을 분리하라는 feedback을 받았습니다.
    피드백에서 요구하는건 클래스 메서드에서 'value만 return' 하는 모델같은데
    전 sysout으로 출력을 하게 했거든요.
    제 player, dealer,blackjack 클래스의 메서드를 보시고
    business와 ui로직 분리에 대한 아이디어를 주셨으면 합니다!

Copy link
Contributor

@jnsorn jnsorn left a comment

Choose a reason for hiding this comment

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

  1. The meaning of bettingMoney is information about how much players bet in the game. It was declared final because it is a constant that stores the initial input value.
    You got it wrong. It is not a variable that stores the final amount after the game. The final amount is only output and does not have to be a variable.
    But if you want to have the final amount for all the game results, you will have to be declared a variable, not a final, as you have done.

  2. View Logic separation can be applied according to your style after seeing how others separate it. I don't know much about view separation, but if you look at the view package on my repo (https://github.com/jnsorn/java-blackjack-precourse/tree/jnsorn), it might help a little.

  3. You can create a parent class and use inheritance to implement objects that do the same thing.

cards = CardFactory.create();
dealer = new Dealer();
rule = new Rule();
rule = new Rule();
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary line

for(int i=0 ; i<names.length;i++) {
System.out.println(names[i]+"의 배팅 금액은?");
// bettingMoney = sc.next();
bettingMoney = "1000";
Copy link
Contributor

Choose a reason for hiding this comment

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

The betting money must be input by user

Comment on lines +91 to +93
if(i!=players.size()-1) {
System.out.print(",");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use Java API. With Join , you can print comma-separated list.

createByType(cards, symbol);
}
return Collections.unmodifiableList(cards);
return cards;
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason It gave the card as an unmodifiable list is because after mixing it randomly in a real game, there will be no changes in the card during that game. Therefore, during the game, you must have an unmodifiable card and mix randomly before return

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