Skip to content

[손정한_Backend] 1주차 과제 제출합니다.#19

Open
jhson7100 wants to merge 10 commits intoBCSDLab-Edu:mainfrom
jhson7100:main
Open

[손정한_Backend] 1주차 과제 제출합니다.#19
jhson7100 wants to merge 10 commits intoBCSDLab-Edu:mainfrom
jhson7100:main

Conversation

@jhson7100
Copy link
Copy Markdown

@jhson7100 jhson7100 commented Mar 31, 2026

No description provided.

Copy link
Copy Markdown

@Soundbar91 Soundbar91 left a comment

Choose a reason for hiding this comment

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

첫 번째 과제 고생하셨습니다 !
기본 문법을 충실히 잘 이행 해주신거 같아서, 크게 코멘트 달 부분이 없네요 👍

}
}

private List<String> findWinners() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

함수(또는 메서드)가 한 가지 일만 하도록 최대한 작게 만들어라.

해당 메소드는 지금 주석에 작성해주신 것 처럼 두 가지 일을 하고 있네요 👀
요구사항을 만족 시킬려면 어떻게 해야할지 고민해보면 좋을 거 같습니다

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

요구사항을 만족하려면 가장 멀리 간 자동차의 위치를 찾는 메소드와 우승자를 찾는 메소드로 나누는 것이 좋을 것 같습니다. 피드백 감사합니다!


public int getCount() {
System.out.println("시도할 회수는 몇회인가요?");
String input = Console.readLine(); //처음부터 int로 받는 것보다 String으로 받고 int로 바꾸는게 더 정확함
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

처음부터 int로 받는 것보다 String으로 받고 int로 바꾸는게 더 정확함

혹시 이렇게 생각하신 이유를 여쭤봐도 될까요 👀

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

문자열에 대해서 찾아보다가 int로 입력을 받을 때 사용자가 문자열을 입력할 경우 에러가 발생하기 때문에 String으로 일단 받고 나중에 int로 변환하는 것이 더 좋다고 하여 저렇게 주석을 적게 되었습니다.

Comment on lines +4 to +5
String name;
int position = 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

보통은 기본값으로 접근 제어자를 설정하기 보다는 명시적으로라도 설정하는 거 같아요 !

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

그럼 접근 제어자로 private를 사용하는게 좋을까요?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

name과 position의 경우 외부에서 직접 참조하여 수정이 되면 안되는 요소라고 생각해서 private으로 선언하는 게 좋아보입니다 !

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.

3 participants