Skip to content

Conversation

seryn6911-hub
Copy link

@seryn6911-hub seryn6911-hub commented Sep 29, 2025

No description provided.

Copy link

@0702Yoon 0702Yoon left a comment

Choose a reason for hiding this comment

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

Controller 26번줄 까지 코드리뷰한 상태입니다.

추석동안 고생하셨어요!

Comment on lines +4 to +6
default String readLine() {
return null;
}

Choose a reason for hiding this comment

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

이 default의 의미는 무엇인가요?

Comment on lines 14 to 16
public View() {
this.reader = new Scan(); // Scan은 InputReader 구현체
}

Choose a reason for hiding this comment

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

헌우님이 올리신 appConfig를 읽고 적용해보세요!
인터페이스 활용은 잘하신 것 같아요.

Comment on lines 31 to 39
// 음수 또는 0 체크
if (purchasePrice <= 0) {
throw new IllegalArgumentException(ErrorMessage.INVALID_AMOUNT.getMessage());
}

// 1000원 단위 체크
if (purchasePrice % 1000 != 0) {
throw new IllegalArgumentException(ErrorMessage.INVALID_AMOUNT.getMessage());
}

Choose a reason for hiding this comment

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

값을 검사하는 객체가 있으면 더 좋을 것 같아요

import java.util.List;

public class Lotto_purchaser {
private final int price;

Choose a reason for hiding this comment

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

이거는 언제 쓰시는 거죠??

List<Lotto> lottos = new ArrayList<>();
int ticketCount = costToTicketNUM();
for (int i = 0; i < ticketCount; i++) {
List<Integer> numbers = Randoms.pickUniqueNumbersInRange(1, 45, 6);

Choose a reason for hiding this comment

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

매직넘버 적용하면 좋겠네요

List<Integer> numbers = Randoms.pickUniqueNumbersInRange(1, 45, 6);
lottos.add(new Lotto(numbers));
}
this.lottos = lottos;

Choose a reason for hiding this comment

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

이 코드의 의미는 뭔가요??

Comment on lines +39 to +43





Choose a reason for hiding this comment

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

코드 컨벤션에 대해서 알아보세요!

lottos.add(new Lotto(numbers));
}
this.lottos = lottos;
List<List<Integer>> lottoList = new ArrayList<>();

Choose a reason for hiding this comment

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

List가 아니라 List<List>로 하신 이유가 뭔가요??

Copy link

@baaamk baaamk left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

MVC 에 대해서 더 공부해보시면 좋을 것 같습니다.

AppConfig 적극 활용해주세요!

Comment on lines +4 to +9
SIX, // 1등
FIVE_AND_BONUS, // 2등
FIVE, // 3등
FOUR, // 4등
THREE // 5등
// 꽝
Copy link

Choose a reason for hiding this comment

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

이렇게 하면 협업하는 입장에서 좋을지 생각해보셔야 할 것 같습니다ㅏ

Comment on lines +8 to +13
try {
View view = new View();
Contoller controller = new Contoller(view);
controller.startController();
} catch (IllegalArgumentException e) {
// 예외 발생 시 조용히 종료 - 추가 출력 없음
Copy link

Choose a reason for hiding this comment

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

AppConfig 사용해보세용
"AppConfig 순수자바" 키워드로 검색하신 후 공부하면 좋을 것 같아요

Copy link

Choose a reason for hiding this comment

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

컨트롤러가 너무 담당하는 일이 많고, 협력 객체를 직접 생성하고 있기 때문에 결합도가 너무 높습니다.
컨트롤러는 단순히 view와 model을 연결해 주는 곳이라고 생각하시면 됩니다. 유효성 검사가 컨트롤러에 있을 필요가 있을지 생각해 보시는게 좋을 것 같습니다!
AppConfig를 사용하셔서 담당하는 일을 줄이고, DI(생성자 주입)를 사용하셔보시기 바랍니다!

throw e;
}
}
} No newline at end of file
Copy link

Choose a reason for hiding this comment

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



public Map<Rank, Integer> calculateWinningStatistics() {
Map<Rank, Integer> result = new EnumMap<>(Rank.class);
Copy link

Choose a reason for hiding this comment

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

EnumMap을 쓰신 이유가 있으실까요?

Comment on lines +14 to +22
private void validate(List<Integer> numbers) {
if (numbers.size() != 6) {
throw new IllegalArgumentException("로또 번호가 많거나 적음");
}

if (numbers.size() != new HashSet<>(numbers).size()) {
throw new IllegalArgumentException("로또 번호는 중복될 수 없습니다.");
}
}
Copy link

Choose a reason for hiding this comment

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

에러 enum을 만드셨으니 이건 수정해주세요!

import java.util.ArrayList;
import java.util.List;

public class Lotto_purchaser {
Copy link

Choose a reason for hiding this comment

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

카멜 케이스로 통일해주세요


// 구매 금액에 따른 로또 티켓 수 반환
public int costToTicketNUM() {
return costOfPurchasing / 1000;
Copy link

Choose a reason for hiding this comment

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

이것도 매직넘버 필요합니다!

Copy link

Choose a reason for hiding this comment

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

음 검증 전용으로 책임을 분리한건 좋습니다.
하지만 책임 분리가 곧 클래스를 무조건 나눈다는 뜻은 아닙니다.
이 점 생각하셔서 책임을 적절한 곳에 분배해 보세요!!

Comment on lines +81 to +94
public void winningStatistics(Map<Rank, Integer> statistics, double lottoYield) {
System.out.println("당첨 통계");
System.out.println("---");

System.out.println("3개 일치 (5,000원) - " + statistics.get(Rank.THREE) + "개");
System.out.println("4개 일치 (50,000원) - " + statistics.get(Rank.FOUR) + "개");
System.out.println("5개 일치 (1,500,000원) - " + statistics.get(Rank.FIVE) + "개");
System.out.println("5개 일치, 보너스 볼 일치 (30,000,000원) - "
+ statistics.get(Rank.FIVE_AND_BONUS) + "개");
System.out.println("6개 일치 (2,000,000,000원) - " + statistics.get(Rank.SIX) + "개");

System.out.printf("총 수익률은 %.1f%%입니다.%n", lottoYield);
}

Copy link

Choose a reason for hiding this comment

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

view가 모델 내부를 알고있으면 안됩니다.
MVC 설계에서 View는 Model을 알면 안 되고, Model은 View를 알면 안 됩니다!

DTO를 활용해서 해보시는건 어떨까요??

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