-
Notifications
You must be signed in to change notification settings - Fork 56
[BCSD Lab] 임아리 4차시 미션 제출합니다. #75
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: dldb-chamchi
Are you sure you want to change the base?
Conversation
src/main/java/model/Line.java
Outdated
Random random = new Random(); | ||
for (int i = 0; i < points.size() - 1; i++) { |
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.
여기에 줄바꿈이 필요해 보여요!
src/main/java/model/Player.java
Outdated
private final String name; | ||
|
||
public Player(String name) { | ||
if (name.length() > 5) { |
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.
5라는 매직넘버는 상수화 할 수 있을 것 같아요
import java.util.*; | ||
|
||
public class Ladder { | ||
private final List<Line> lines; |
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.
다른 곳도 마찬가지로 클래스의 시작 부분은 줄바꿈 문자를 하나 넣어주세요!
src/main/java/view/InputView.java
Outdated
|
||
public static String getQuery() { | ||
System.out.println("결과를 보고 싶은 사람은?"); | ||
return scanner.next(); |
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.
오....!!! nextInt()
를 하면 개행 문자가 버퍼에 남아있는 문제가 있어서 다음에 nextLine()
호출 시 바로 개행 문자가 입력되는 문제가 있었는데 next()
를 쓰면 개행 문자를 포함하지 않는군요.
좋은 정보 하나 알아갑니다!! 👍
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.
넵 맞습니다 ㅎㅎ 김상진 교수님의 자바프로그래밍에서 배웠습니다! 도움이 되었다니 기쁩니다!
if (query.equals("all")) { | ||
ResultView.printAllResults(ladderResult.getAllResults()); | ||
break; | ||
} | ||
|
||
if (ladderResult.getAllResults().containsKey(query)) { | ||
ResultView.printResult(query, ladderResult.getResult(query)); | ||
} |
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.
여기처럼 다른 코드도 if문 사이에 줄바꿈이 들어오면 더 가독성이 좋아질 것 같아요.
- 입력받은 값이
all
이면 if문에서break
하도록 설계하셨는데, 해당 조건이while
문에 들어가도 되지 않을까요?
만약 제가 말한 방식처럼 하실거면while
보다는do-while
이 더 적합할 것 같아요!
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.
그것도 좋은 방법입니다! 사람마다 취향이 다른데 저 같은 경우는 이런식으로 if를 걸어서 하는 것을 더 선호합니다! 다른 의견 주셔서 감사합니다!
else { | ||
System.out.println("존재하지 않는 이름입니다. 다시 입력해주세요."); | ||
} |
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.
저는 존재하지 않는 이름을 입력하면 예외를 발생하도록 만들었는데 이렇게 무한 루프로 정상적인 값을 입력받을 때까지 돌아가도록 할 수도 있군요!
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.
넵! 저는 이번 미션이 all입력을 제외한 입력들은 정상 값이 들어오기 전까지 계속해서 입력을 받을 필요가 있다고 해석하여 이런식으로 작성하였습니다!
src/main/java/model/Player.java
Outdated
|
||
public Player(String name) { | ||
if (name.length() > 5) { | ||
throw new IllegalArgumentException("이름은 최대 5글자까지 가능합니다."); |
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.
에러 메시지도 한 곳에 모아 관리하는 방법은 어떻게 생각하시나요??
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.
좋은 방법입니다! 하드 코딩 되어있으니 한번 바꿔보겠습니다!
src/test/java/model/PlayerTest.java
Outdated
|
||
@Test | ||
void 이름이_5자를_초과하면_예외() { | ||
assertThrows(IllegalArgumentException.class, () -> new Player("abcdef")); |
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.
예외가 발생하면서 나오는 메시지에 대해서도 테스트해보시면 더 좋을 것 같아요!
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.
짧은시간동안 고생하셨습니다
이제 코인개발 해봐요!!!!
LadderController ladderGameController = new LadderController(); | ||
ladderGameController.start(); |
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.
지난번에 비해서 간결해졌네요 👍
this.players = createPlayers(names); | ||
this.results = results; | ||
this.ladder = new Ladder(players.size(), height); |
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.
this
는 제거해도 괜찮을 것 같아요
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.
넵!!
if (name.length() > MAX_NAME_LENGTH) { | ||
throw new IllegalArgumentException(ErrorMessage.LIMIT_NAME_LENGTH); |
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 LadderController { | ||
|
||
private List<Player> players; |
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.
일급 컬렉션
으로 관리를 해도 괜찮을 것 같아요
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.
조언 감사합니다!
그동안 리뷰해주셔서 감사합니다~! |
드디어 마지막 미션입니다!! 이번 미션은 무난하게 진행 했습니다. 최대한 컨벤션 신경 쓰고, 그동안의 리뷰를 반영하도록 노력하였습니다.
모두 수고하셨습니다!!