Skip to content

Conversation

@gjwlgh
Copy link

@gjwlgh gjwlgh commented Apr 22, 2020

No description provided.

Copy link
Member

@kouz95 kouz95 left a 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;
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

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

자바 컨벤션에 따르면 변수명에 언더바를 붙이지 않습니다 :)

https://naver.github.io/hackday-conventions-java/

}
else{
_computerNum[numBoundary]=random.nextInt(8)+1;
if(numBoundary==1 && _computerNum[numBoundary]==_computerNum[numBoundary-1]) continue;
Copy link
Member

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){
Copy link
Member

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) {
Copy link
Member

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();
Copy link
Member

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(){
Copy link
Member

Choose a reason for hiding this comment

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

무엇을 만들어 내는지 표현할수 있지 않을까요?

Computer.create()는 마치 생성자와 같은 느낌이 들어 혼동이 올 수 있을것 같아요!

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