-
Notifications
You must be signed in to change notification settings - Fork 3
Self feedback #1
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
base: master
Are you sure you want to change the base?
Conversation
jnsorn
left a comment
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.
-
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. -
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.
-
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(); |
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.
unnecessary line
| for(int i=0 ; i<names.length;i++) { | ||
| System.out.println(names[i]+"의 배팅 금액은?"); | ||
| // bettingMoney = sc.next(); | ||
| bettingMoney = "1000"; |
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.
The betting money must be input by user
| if(i!=players.size()-1) { | ||
| System.out.print(","); | ||
| } |
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.
Use Java API. With Join , you can print comma-separated list.
| createByType(cards, symbol); | ||
| } | ||
| return Collections.unmodifiableList(cards); | ||
| return 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.
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
self feedback 4 + 2 question
-four Self feedback -
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
follow the programming rules
i know it's hard to do but really helpful to make clean and readable code
keep chasing the efficient code and get confidence
rush to code with confidence attitude but don't forget it;s not perfect
get feedback and please edit your code
i think this is the good way to better level
-two question -
how do you handle the params that defined as final?
Player 클래스에서 List 타입으로 선언된 cards의 경우는
클래스 메서드에서 list.add 함수를 이용해 객체를 하나씩 추가하는게 가능했습니다.
그러나 int, double과 같은 변수들은 추가의 개념이 아니라 '값의 변경'이 일어나서
get,set 메서드를 사용해야 했습니다.
값 변경을 위해 저는 final로 선언된 bettingMoney에서 final을 지워버렸네요...
지난 과제에서 business logic과 UI logic을 분리하라는 feedback을 받았습니다.
피드백에서 요구하는건 클래스 메서드에서 'value만 return' 하는 모델같은데
전 sysout으로 출력을 하게 했거든요.
제 player, dealer,blackjack 클래스의 메서드를 보시고
business와 ui로직 분리에 대한 아이디어를 주셨으면 합니다!