Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

πŸš€ 4단계 - 둜또(μˆ˜λ™) #3763

Open
wants to merge 7 commits into
base: hhhhhwi
Choose a base branch
from

Conversation

hhhhhwi
Copy link

@hhhhhwi hhhhhwi commented Apr 4, 2024

μ•ˆλ…•ν•˜μ„Έμš”! PR이 점점 더 λŠ¦μ–΄μ§€λ„€μš” γ… 

κ·Έλž˜λ„ μ΅œμ„ μ„ λ‹€ ν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€ γ… 

이번 λ―Έμ…˜μ€.. μ‰¬μšΈ 거라고 μƒκ°ν–ˆλŠ”λ° 생각보닀 κ³ λ―Όν•΄μ•Ό λ˜λŠ” 지점이 λ§Žμ•˜μŠ΅λ‹ˆλ‹€ γ… 

제일 κ³ λ―Όλ˜μ—ˆλ˜ 지점은

  1. ManualLottoNumberStrategy 적용 μ‹œ μ‚¬μš©μžμ˜ μž…λ ₯κ°’ λŒ€λ‘œ λ‘œλ˜λ²ˆν˜Έκ°€ μƒμ„±λ˜κΈ° 떄문에 InputView의 역할이 λ°˜λ“œμ‹œ ν•„μš”ν•œλ°,
    이 λ•Œ μž…λ ₯의 μ±…μž„μ„ 도메인 λ‘œμ§μ— 넣을 것인가?

  2. LottoNumbers와 WinningNumbers의 검증 둜직 μΈ‘λ©΄μ—μ„œλŠ” 성격이 κ°™μ§€λ§Œ, 역할이 λ‹€λ₯Έ 데 WinningNumbers에 LottoNumbersλ₯Ό 쑰합해도 될까?

μœ„ μ§€μ λ“€μ΄μ˜€μŠ΅λ‹ˆλ‹€. ν”Όλ“œλ°±μ„ λ°›λŠ” 게 더 쒋을 것 κ°™μ•„ 일단 μ‘°μ•…ν•œ μ½”λ“œ πŸ˜“ μ΄μ§€λ§Œ PR λ¨Όμ € μ˜¬λ¦½λ‹ˆλ‹€! 잘 λΆ€νƒλ“œλ¦½λ‹ˆλ‹€!

@neojjc2 neojjc2 self-requested a review April 5, 2024 05:29
@neojjc2
Copy link

neojjc2 commented Apr 5, 2024

#tag @neojjc2

@neojjc2 neojjc2 self-assigned this Apr 5, 2024
@neojjc2
Copy link

neojjc2 commented Apr 5, 2024

μ•ˆλ…•ν•˜μ„Έμš”! PR이 점점 더 λŠ¦μ–΄μ§€λ„€μš” γ… 

κ·Έλž˜λ„ μ΅œμ„ μ„ λ‹€ ν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€ γ… 

이번 λ―Έμ…˜μ€.. μ‰¬μšΈ 거라고 μƒκ°ν–ˆλŠ”λ° 생각보닀 κ³ λ―Όν•΄μ•Ό λ˜λŠ” 지점이 λ§Žμ•˜μŠ΅λ‹ˆλ‹€ γ… 

제일 κ³ λ―Όλ˜μ—ˆλ˜ 지점은

  1. ManualLottoNumberStrategy 적용 μ‹œ μ‚¬μš©μžμ˜ μž…λ ₯κ°’ λŒ€λ‘œ λ‘œλ˜λ²ˆν˜Έκ°€ μƒμ„±λ˜κΈ° 떄문에 InputView의 역할이 λ°˜λ“œμ‹œ ν•„μš”ν•œλ°,
    이 λ•Œ μž…λ ₯의 μ±…μž„μ„ 도메인 λ‘œμ§μ— 넣을 것인가?
  2. LottoNumbers와 WinningNumbers의 검증 둜직 μΈ‘λ©΄μ—μ„œλŠ” 성격이 κ°™μ§€λ§Œ, 역할이 λ‹€λ₯Έ 데 WinningNumbers에 LottoNumbersλ₯Ό 쑰합해도 될까?

μœ„ μ§€μ λ“€μ΄μ˜€μŠ΅λ‹ˆλ‹€. ν”Όλ“œλ°±μ„ λ°›λŠ” 게 더 쒋을 것 κ°™μ•„ 일단 μ‘°μ•…ν•œ μ½”λ“œ πŸ˜“ μ΄μ§€λ§Œ PR λ¨Όμ € μ˜¬λ¦½λ‹ˆλ‹€! 잘 λΆ€νƒλ“œλ¦½λ‹ˆλ‹€!

μ‘°μ•…ν•˜λ‹€λ‡¨ 무슨 그런 말씀을 πŸ˜…
이미 큰 μ½”λ“œ μˆ˜μ • 없이 λ§ˆμ§€λ§‰ 단계 μš”κ΅¬μ‚¬ν•­μ΄ λ°˜μ˜λ˜μ—ˆλ‹€λŠ”κ²ƒλ§Œ 봐도
이전 κ΅¬μ‘°λ‚˜ κ°œμ„ μ„ 잘 ν•΄μ£Όμ…”μ„œλΌκ³  μƒκ°ν•©λ‹ˆλ‹€

InputViewλ‚˜ ν˜Ήμ€ Output을 λ‹΄λ‹Ήν•˜λŠ” 역할은 μ–Έμ œλ“  변경이 λ˜μ–΄μ•Όν•  뢀뢄이기 λ•Œλ¬Έμ—
μ΅œλŒ€ν•œ λ„λ©”μΈλ‘œμ§κ³Ό 거리λ₯Ό λ‘κ±°λ‚˜, λ ˆμ΄μ–΄λ₯Ό 톡해 μ„œλ‘œκ°„μ˜ λ³€κ²½λ˜λŠ” 뢀뢄에 λŒ€ν•œ 영ν–₯을 쀄여야 ν•œλ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€.

리뷰 μ½”λ©˜νŠΈλ‘œ 의견 λ“œλ ΈλŠ”λ°μš” πŸ˜„
λ§ˆμ§€λ§‰ λ‹¨κ³„μΈλ§ŒνΌ 쑰금만 더 μ •λ¦¬ν•˜κ³  κ°€μ‹œλ©΄ 쒋을 것 κ°™μŠ΅λ‹ˆλ‹€ πŸ™‡

Copy link

@neojjc2 neojjc2 left a comment

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.

μš”κ΅¬μ‚¬ν•­ 정리 πŸ’―


if(lottoNumbers.stream().anyMatch(x -> x < LOTTO_NUMBER_MIN || x > LOTTO_NUMBER_MAX)) {
throw new IllegalArgumentException("λ²ˆν˜ΈλŠ” " + LOTTO_NUMBER_MIN + " 미만 " + LOTTO_NUMBER_MAX + " 초과인 수λ₯Ό μž…λ ₯ν•  수 μ—†μŠ΅λ‹ˆλ‹€.");
}
Copy link

Choose a reason for hiding this comment

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

κ²€μ¦ν•˜μ‹  λΆ€λΆ„ μ’‹μŠ΅λ‹ˆλ‹€ πŸ‘
λ‹€λ§Œ Integer인 둜또번호 μžμ²΄κ°€ μ›μ‹œκ°μ²΄ν¬μž₯ λœλ‹€λ©΄ μ–΄λ–¨κΉŒμš”??
μ™œλƒν•˜λ©΄ WinningNumbersμ—μ„œ μ‚¬μš©μ€‘μΈ bonusNumber도 κ²°κ΅­ 둜또 λ²ˆν˜Έμ€‘μ— ν•˜λ‚˜μž…λ‹ˆλ‹€ πŸ˜„
둜또 번호 λ²”μœ„μ— λŒ€ν•œ κ²€μ¦ν•˜κ³  μžˆλŠ” μ½”λ“œκ°€ μ€‘λ³΅μœΌλ‘œ μžˆλŠ”λ°μš”, 이 뢀뢄이 μ’€ 정리될 것 κ°™μŠ΅λ‹ˆλ‹€ πŸ™‡

// AS IS
List<Integer> lottoNumbers;

// TO BE
List<LottoNumber> lottoNumbers;

이 λΆ€λΆ„ ν•œλ²ˆ κ°œμ„ κ²€ν†  ν•΄μ£Όμ‹œλ©΄ 쒋을 것 κ°™μŠ΅λ‹ˆλ‹€ πŸ™‡

PrintView.printNumberOfLotto(numberOfLotto);
LottoPrice lottoPrice = new LottoPrice(InputView.inputPurchasePrice(), InputView.inputNumberOfManualLotto());
int numberOfAutoLotto = lottoPrice.getNumberOfAutoLotto();
int numberOfManualLotto = lottoPrice.getNumberOfManualLotto();
Copy link

Choose a reason for hiding this comment

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

LottoPriceλ₯Ό ν†΅ν•΄μ„œ μžλ™, μˆ˜λ™ μˆ˜λŸ‰μ˜ μ—­ν• κ³Ό μ±…μž„μ„ λΆ€μ—¬ν•˜μ‹  λΆ€λΆ„ λ„ˆλ¬΄ μ’‹μŠ΅λ‹ˆλ‹€ πŸ‘

λ‹€λ§Œ LottoMarket에 lottoPriceλ₯Ό μ „λ‹¬ν•΄μ„œ LottoMarketμ—μ„œ μˆ˜λ™λ‘œλ˜λ₯Ό μ‚¬λŠ” 역할을 ν•˜λ©΄ μ–΄λ–¨κΉŒμš”??
μ§€κΈˆ κ΅¬μ‘°μ—μ„œλŠ” main이 μ—†λŠ” 상황이라면 μˆ˜λ™λ‘œλ˜λ₯Ό ꡬ맀할 μˆ˜κ°€ μ—†μŠ΅λ‹ˆλ‹€ πŸ˜„

차라리 μ‚¬μš©μžλ‘œλΆ€ν„° μˆ˜λ™λ‘œλ˜λ²ˆν˜Έλ₯Ό λ‹€ 받은 κ°’κ³Ό , LottoPriceλ₯Ό LottoMarketμ—κ²Œ μ£Όκ³ 
lottoMarket.buy같은 λ©”μ†Œλ“œλ₯Ό ν˜ΈμΆœν•˜κ³  λ‚˜λ©΄ λ‘œλ˜λ²ˆν˜Έκ°€ λ‹΄κΈ΄ 티켓을 λ°˜ν™˜ν•˜λŠ” 그런 ꡬ쑰둜 κ°„λ‹€λ©΄
μ•„λ§ˆ κ³ λ―Όν•˜μ‹œλŠ” 뢀뢄이 μ–΄λŠμ •λ„ κ°œμ„ μ΄ 될 것 κ°™μŠ΅λ‹ˆλ‹€ πŸ˜„

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants