Skip to content

Conversation

@mins1031
Copy link

@mins1031 mins1031 commented Dec 4, 2025

안녕하세요!

4단계 작업해서 PR 드려요
이번주는 감기에 걸려서 생각보다 시간 투자를 못했네요..
이번주 남은 기간동안 로또와 자동차경주 5단계 마무리 하고 다음주부터 수강신청 집중적으로 도전해보려고합니다~

- LottoNum의 명확한 사용제한을 위해 싱글톤 패턴으로 구현
- LottoNum 싱글톤 패턴으로 변경을 위해 로또번호 풀을 LottoNum 내부로 이관
- LottoMachine의 인스턴스 메서드 -> 클래스 메서드화
- 총 상금 계산로직 캡슐화를 위해 WinStandard로 일부 이관
- 네이밍 개선 및 고민사항 의식의 흐름 작성
- 수동 요구사항 도입을 위해 유저 입력정보 클래스 생성
- LottoMachine 에 수동/자동 로또 생성 메서드 추가
- 메세지 출력 부분 개선
- 자동갯수 잘못 노출되는 부분 개선
Copy link
Contributor

@javajigi javajigi left a comment

Choose a reason for hiding this comment

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

요즘 감기 걸린 분들이 많던데 ㅠㅠㅠ
확실히 4단계에 크게 변경된 부분은 많지 않네요. 👍
그럼에도 불구하고 2중 콜렉션 사용이나 Lottos 대신 ManualLottos를 생성한 점은 아쉬움이 남아 피드백 남겨 봤어요.
로또를 생성하는 부분이 여러 객체로 흩어져 복잡도가 높아보이는데요.
로또 생성 부분을 좀 더 응집도를 가지도록 구현해볼 것을 추천합니다.

"이번주 남은 기간동안 로또와 자동차경주 5단계 마무리" -> 적극 공감해요.
2개 미션 마무리하고 다음 주에 다음 미션 도전해도 충분합니다.

import lottogame.model.price.LottoPurchasePrice;
import lottogame.model.winner.WinnerResult;

public class LottoStore {
Copy link
Contributor

Choose a reason for hiding this comment

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

이 객체의 책임 중 로또를 생성하는 책임을 다음과 같은 인터페이스를 추가한 후 분리해 보는 도전을 해보면 어떨까?
코드를 보면 로또를 생성하는 부분이 여러 객체에 분산되어 있는 느낌이 든다.
인터페이스를 추가하고 자동/수동에 대한 구현체를 만들어 로또 생성 부분을 합쳐보면 어떨까?

3단계에서 4단계로 요구사항이 변경될 때 로또를 생성하는 부분의 요구사항만 변경됐다.
로또를 생성하는 부분을 다음과 같은 구조의 인터페이스로 분리해 보는 연습을 해보면 어떨까?
이와 같이 인터페이스로 구현했을 때의 잇점에 대해 고민해 보는 시간을 가져본다.

public interface LottosGenerator {
    Lottos generate();
}


private boolean isOutOfLottoRange(int num) {
return num < MIN_NUM || num > MAX_NUM;
public static LottoNum getInstance(int num) {
Copy link
Contributor

Choose a reason for hiding this comment

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

effective java 책을 보면 정적 팩터리 메서드 이름에 대한 컨벤션 제안을 하고 있다.
이 컨벤션을 찾아 리팩터링 해보면 어떨까?

import java.util.Set;

public class ManualLottos {
private final List<Set<Integer>> manualLottos;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private final List<Set<Integer>> manualLottos;
private final List<Lotto> manualLottos;

Lottos와 다른 점이 있나?
굳이 분리할 필요가 있을까?

}

public static Set<Integer> askBeforeWinNums() {
public static List<Set<Integer>> askManualLottos() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static List<Set<Integer>> askManualLottos() {
public static List<Lotto> askManualLottos() {

2중 콜렉션 사용 금지

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