Skip to content
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

2단계 - 문자열 덧셈 계산기 #5924

Open
wants to merge 2 commits into
base: younghooniii
Choose a base branch
from

Conversation

younghooniii
Copy link

No description provided.

Copy link
Member

@testrace testrace left a comment

Choose a reason for hiding this comment

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

2단계 구현 잘해주셨네요 👍
몇 가지 코멘트 남겨두었는데 확인해 주시고 다시 리뷰 요청해 주세요.

@@ -0,0 +1,42 @@
package study.step2;
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 StringAddCalculator {

public static int splitAndSum(String text) {
Copy link
Member

Choose a reason for hiding this comment

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

프로그래밍 요구사항
메소드가 너무 많은 일을 하지 않도록 분리하기 위해 노력해 본다.
를 지키기 위해 메서드를 분리해 보시면 좋을 것 같아요.

Comment on lines +15 to +16
if (text.startsWith("//")) {
Matcher m = Pattern.compile("//(.)\n(.*)").matcher(text);
Copy link
Member

Choose a reason for hiding this comment

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

변경되지 않는 문자열이나 패턴 객체는 상수로 선언해 이름을 부여하면 어떨까요?

Comment on lines +30 to +37
try {
number = Integer.parseInt(token);
} catch (NumberFormatException e) {
throw new RuntimeException("숫자가 아닌 값이 포함되어 있습니다: " + token);
}
if (number < 0) {
throw new RuntimeException("음수는 허용되지 않습니다: " + number);
}
Copy link
Member

Choose a reason for hiding this comment

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

문자열을 분리하기 전에 유효성을 먼저 검증하면 어떨까요?

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

public class SetTest {
Copy link
Member

Choose a reason for hiding this comment

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

피드백이 반영되지 않은 커밋이 그대로 남아 있네요.
온라인 코드 요청 3단계 가이드 문서를 참고해서 rebase 후 피드백 반영도 함께 해주시면 좋을 것 같아요

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