Skip to content

2단계 - 사다리(생성) #2402

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

Open
wants to merge 4 commits into
base: chanseong95
Choose a base branch
from

Conversation

chanSeong95
Copy link

리뷰 부탁드려요!

LadderLineGenerator 클래스에서 랜덤으로 사다리 라인 생성하는 건 테스트 코드를 작성하지 않았는데, 단순히 mocking 테스트를 작성하는 건 LadderLine 테스트 코드와 겹친다고 생각해서 의미가 없다고 생각했습니다.

brody added 4 commits April 20, 2025 18:42
- InputView.java 추가: 입력 담당 클래스
- PersonName.java 추가: 사다리 이름 담당 클래스
- LadderLine.java 추가: 사다리 라인 역할
- PersonName.java: toString 추가
- LadderLines.java, PersonNames.java 추가: 일급 컬렉션 클래스
- LadderLine.java 추가: 사다리 라인 역할
- LadderLine.java, LadderLines.java: toString 추가
- Ladder.java 추가: 사다리 클래스
- LadderLineGenerator.java 추가: 사다리 라인 랜덤 생성 클래스
- LadderMain.java 추가: 사다리 게임 메인 메소드
- ReviewView.java 추가: 출력 담당 클래스
- LadderLine.java: 테스트 추가
- PersonNames.java: 생성자 Set 대신 List 받게 변경.
Copy link

@brainbackdoor brainbackdoor left a comment

Choose a reason for hiding this comment

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

안녕하세요! 미션 진행하느라 고생하셨어요~ 👍🏻
전반적으로 잘 작성해주셨는데요. 프로그래밍 요구사항을 준수하지 않은 부분들이 있어 우선 Request Chages 해요~ 좋은 하루 보내세요! 👋🏻

Comment on lines +27 to +33
while (iterator.hasNext()) {
boolean cur = iterator.next();
if (prev && cur) {
throw new IllegalArgumentException("Ladder lines cannot be connected continuously.");
}
prev = cur;
}

Choose a reason for hiding this comment

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

  • indent 2를 허용하지 않는 등 기존 미션의 프로그래밍 요구사항도 준수하셔야 해요~

Comment on lines +36 to +45
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
for (Boolean line : lines) {
sb.append("|");
sb.append(line ? "--------": " ");
}
sb.append("|");
return sb.toString();
}

Choose a reason for hiding this comment

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

  • Presentation Layer와의 결합이 발생할 우려가 있네요. 위와 같이 작성하는게 현재 수준에서는 합리적이긴 하다는 생각이 들기는 하는데요. View Model과의 결합을 한번 분리해보시죠~

Comment on lines +44 to +70
public static List<String> getPersonNameInput(String prompt, String delimiter) {
System.out.println(prompt);
while (true) {
String line = scanner.nextLine();

String[] split = line.split(delimiter);
if (split.length == 0) {
System.out.println("이름은 하나 이상 입력되어야 합니다. 다시 입력해 주세요.");
continue;
}

List<String> result = Arrays.stream(split)
.map(String::trim)
.filter(s -> !s.isEmpty())
.collect(Collectors.toList());

if (split.length != result.size()) {
System.out.println("이름은 중복될 수 없습니다. 다시 입력해 주세요.");
continue;
}

if (result.stream().allMatch(s -> s.length() <= PersonName.MAX_NAME_LENGTH)) {
return result;
}

System.out.println("이름은 최대 5글자까지 사용 가능합니다. 다시 입력해 주세요.");
}

Choose a reason for hiding this comment

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

  • 15라인에 대한 규칙도 있었지요..?

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