-
Notifications
You must be signed in to change notification settings - Fork 3
Mission 1 - 클래스분리 #6
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: gjwlgh
Are you sure you want to change the base?
Conversation
kouz95
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.
첫 객체 분리네요 :) 고생 많으셨습니다.
피드백 남겼으니 확인해주세요!
추가적으로 컨벤션에 신경쓰면 좋을것 같아요 :)
- 인텔리제이의 자동 포맷 기능이 많은 부분들 교정해주기도 한답니다.
코드 자동 정렬하기 (Reformat Code)
MacOS: Cmd + Opt + l
Win/Linux: Ctrl + Alt + l
https://gmlwjd9405.github.io/2019/05/21/intellij-shortkey.html
| int game = 1; | ||
|
|
||
| while(game==1){ | ||
| int[] computer; |
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.
Collection의 List를 사용해보는건 어떨까요?
| } | ||
| public static void main(String[] args) { | ||
| final int INITIAL_COUNT = 0; | ||
| final int Initial_Num = 0; |
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.
상수는 보통 전체 대문자와 _로 띄어쓰기를 표현한답니다 :)
밑에 작성해주신 MAX_NUMBER_LENGTH 처럼요!
|
|
||
| while(numBoundary<3){ | ||
| if(numBoundary==0){ | ||
| _computerNum[numBoundary]=random.nextInt(8)+1; |
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.
자바 컨벤션에 따르면 변수명에 언더바를 붙이지 않습니다 :)
| } | ||
| else{ | ||
| _computerNum[numBoundary]=random.nextInt(8)+1; | ||
| if(numBoundary==1 && _computerNum[numBoundary]==_computerNum[numBoundary-1]) continue; |
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.
한 줄로 끝나더라도 중괄호는 열어주세요!
| return _computerNum; | ||
| } | ||
|
|
||
| public static int[] Check(int[] _userNum, int[] _computerNum){ |
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.
메소드명은 소문자로 시작하고, 클래스명은 대문자로 시작합니다.
| for (int j = 0; j < 3; j++) { | ||
| for (int k = 0; k < 3; k++) { | ||
| if (_computerNum[j] == _userNum[k]) { | ||
| if (j == k) { |
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.
indent가 4가 되는 부분이네요 😥
indent를 줄이는 가장 간단한 방법은 메소드 분리입니다!
| public static int[] Create(){ | ||
| Scanner input = new Scanner(System.in); | ||
| int[] _userNum = new int[3]; | ||
| int tmp = input.nextInt(); |
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.
변수명에 의도를 담을수 있지 않을까요?
|
|
||
| public class Computer { | ||
|
|
||
| public static int[] Create(){ |
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.
무엇을 만들어 내는지 표현할수 있지 않을까요?
Computer.create()는 마치 생성자와 같은 느낌이 들어 혼동이 올 수 있을것 같아요!
No description provided.