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

πŸš€ 3단계 - ν…ŒμŠ€νŠΈλ₯Ό ν†΅ν•œ μ½”λ“œ 보호 #847

Merged
merged 87 commits into from
Feb 13, 2025

Conversation

AlbertImKr
Copy link

μ•ˆλ…•ν•˜μ„Έμš”. πŸ˜ƒ λ¦¬λ·°μ–΄λ‹˜!

λΉ„μ¦ˆλ‹ˆμŠ€ 둜직 ν…ŒμŠ€νŠΈ μ½”λ“œλ₯Ό μ—΄μ‹¬νžˆ μž‘μ„±ν–ˆμŠ΅λ‹ˆλ‹€.

톡합 ν…ŒμŠ€νŠΈλŠ” κ°„λ‹¨νžˆλ§Œ μž‘μ„±ν•΄λ³΄μ•˜μŠ΅λ‹ˆλ‹€.

리뷰 μš”μ²­λ“œλ¦½λ‹ˆλ‹€.

κ°μ‚¬ν•©λ‹ˆλ‹€!

ν‘œμ‹œ -> ν™œμ„±ν™”
μˆ¨κΉ€ -> λΉ„ν™œμ„±ν™”
Copy link
Member

@dkswnkk dkswnkk left a comment

Choose a reason for hiding this comment

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

ν™κ΄‘λ‹˜ 3단계 λ―Έμ…˜ 잘 μ§„ν–‰ν•΄μ£Όμ…¨μŠ΅λ‹ˆλ‹€. πŸ‘
λͺ‡κ°€μ§€ 질문과 μΆ”κ°€ μ½”λ©˜νŠΈ λ‚¨κ²¨λ‘μ—ˆλŠ”λ°, 확인 λΆ€νƒλ“œλ¦΄κ²Œμš”. πŸ™

README.md Outdated Show resolved Hide resolved
src/test/java/kitchenpos/application/MenuServiceTest.java Outdated Show resolved Hide resolved
src/test/java/kitchenpos/application/MenuServiceTest.java Outdated Show resolved Hide resolved
src/test/java/kitchenpos/application/OrderServiceTest.java Outdated Show resolved Hide resolved
src/test/java/kitchenpos/util/FixtureProvider.java Outdated Show resolved Hide resolved
@AlbertImKr
Copy link
Author

Fixture λŒ€μ‹  Builder νŒ¨ν„΄μ„ μ‚¬μš©ν–ˆμ–΄μš”. μ½”λ“œκ°€ 쑰금 κΈΈμ§€λ§Œ, κ·Έλž˜λ„ 가독성이 λ‚˜μ˜μ§€ μ•Šμ§€ μ•Šμ„κΉŒμš”? λ¦¬λ·°μ–΄λ‹˜μ˜ 생각이 κΆκΈˆν•©λ‹ˆλ‹€.

@dkswnkk
Copy link
Member

dkswnkk commented Feb 11, 2025

Fixture λŒ€μ‹  Builder νŒ¨ν„΄μ„ μ‚¬μš©ν–ˆμ–΄μš”. μ½”λ“œκ°€ 쑰금 κΈΈμ§€λ§Œ, κ·Έλž˜λ„ 가독성이 λ‚˜μ˜μ§€ μ•Šμ§€ μ•Šμ„κΉŒμš”? λ¦¬λ·°μ–΄λ‹˜μ˜ 생각이 κΆκΈˆν•©λ‹ˆλ‹€.

μ œκ°€ 보기엔 가독성이 더 μ’‹μ•„μ‘Œλ‹€κ³  λŠκ»΄μ Έμ„œ μ’‹μ•˜μ–΄μš”! 그리고 μ—¬κΈ°μ„œ 더 μ½”λ“œλ₯Ό 쀄이고 μ‹Άλ‹€λ©΄ 각 ν…ŒμŠ€νŠΈμ—μ„œ ν•„μš” μ—†λŠ” ν•„λ“œλ“€μ€ κΌ­ 넣어주지 μ•Šμ•„λ„ λ˜μ§€ μ•Šμ„κΉŒ μ‹Άλ„€μš”!

Copy link
Member

@dkswnkk dkswnkk left a comment

Choose a reason for hiding this comment

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

μ§ˆλ¬Έλ“€μ— λŒ€ν•΄ μ½”λ©˜νŠΈ λ‚¨κ²ΌμŠ΅λ‹ˆλ‹€.πŸ‘

μΆ”κ°€λ‘œ ν˜„μž¬ Mock λ°©μ‹μœΌλ‘œ ν…ŒμŠ€νŠΈλ₯Ό μž‘μ„±ν•΄ μ£Όμ…¨λŠ”λ°, 이번 κ°•μ˜μ—μ„œ μ§„ν–‰ν•œ Fake 객체λ₯Ό μ‚¬μš©ν–ˆμ„ λ•Œμ˜ μž₯단점은 λ¬΄μ—‡μΌκΉŒμš”? ν•œλ²ˆ μ•Œμ•„λ³΄μ‹œκ³  기둝으둜 남기면 μ’‹μ•˜μœΌλ©΄ ν•΄μ„œ μ§ˆλ¬Έλ“œλ €μš”!

ν™•μΈν•˜μ‹œκ³  λ‹€μ‹œ μš”μ²­ μ£Όμ‹œλ©΄ λ°”λ‘œ 머지 ν•˜κ² μŠ΅λ‹ˆλ‹€.πŸ˜„

@AlbertImKr
Copy link
Author

Mock λ°©μ‹μ˜ μž₯단점

Mock 방식은 Mock 라이브러리λ₯Ό μ‚¬μš©ν•˜μ—¬ ν…ŒμŠ€νŠΈν•  객체의 νŠΉμ • λ™μž‘μ„ λͺ¨λ°©ν•˜λŠ” λ°©μ‹μž…λ‹ˆλ‹€.

βœ… μž₯점

  • νŠΉμ • λ™μž‘(예: ν•¨μˆ˜ 호좜 μ—¬λΆ€, 호좜 횟수 λ“±)에 λŒ€ν•œ ν…ŒμŠ€νŠΈ 용이
  • μ™ΈλΆ€ μ‹œμŠ€ν…œ(DB, λ„€νŠΈμ›Œν¬ λ“±)κ³Ό κ²©λ¦¬ν•˜μ—¬ ν…ŒμŠ€νŠΈ κ°€λŠ₯

❌ 단점

  • κ΅¬ν˜„λ³΄λ‹€λŠ” λ™μž‘μ„ κ²€μ¦ν•˜λŠ” 데 μ§‘μ€‘ν•˜λ―€λ‘œ, μ‹€μ œ λ™μž‘μ„ 보μž₯ν•˜μ§€ λͺ»ν•  μˆ˜λ„ 있음
  • Mock 객체 섀정이 λ§Žμ•„μ§ˆ 경우 가독성이 λ–¨μ–΄μ§ˆ 수 있음

Fake λ°©μ‹μ˜ μž₯단점

Fake 방식은 ν…ŒμŠ€νŠΈλ₯Ό μœ„ν•΄ 직접 κ°€λ²Όμš΄ λŒ€μ²΄ κ΅¬ν˜„μ„ μ œκ³΅ν•˜λŠ” λ°©μ‹μž…λ‹ˆλ‹€.

βœ… μž₯점

  • Mock보닀 μ‹€μ œ λ™μž‘μ„ μ’€ 더 λ°˜μ˜ν•  수 μžˆμ–΄ ν…ŒμŠ€νŠΈ 신뒰도가 λ†’μŒ
  • νŠΉμ •ν•œ λ°μ΄ν„°λ‚˜ μƒνƒœλ₯Ό κ°€μ§ˆ 수 μžˆμ–΄ λ‹€μ–‘ν•œ ν…ŒμŠ€νŠΈκ°€ κ°€λŠ₯

❌ 단점

  • μ‹€μ œ λ™μž‘κ³Ό 100% λ™μΌν•˜λ‹€κ³  보μž₯ν•  수 μ—†μŒ
  • λ³΅μž‘ν•œ κΈ°λŠ₯을 가진 Fakeλ₯Ό λ§Œλ“€λ©΄ μœ μ§€λ³΄μˆ˜ λΉ„μš©μ΄ 컀질 수 있음
  • κ΅¬ν˜„ν•˜λŠ” 데 μ‹œκ°„μ΄ 걸릴 수 있음

Copy link
Member

@dkswnkk dkswnkk left a comment

Choose a reason for hiding this comment

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

ν™κ΄‘λ‹˜ '도메인 주도 섀계 이해' λ―Έμ…˜ μ§„ν–‰ν•˜μ‹œλŠλΌ 고생 λ§ŽμœΌμ…¨μŠ΅λ‹ˆλ‹€.
남은 λ―Έμ…˜λ“€λ„ λκΉŒμ§€ μ™„μ£Όν•˜μ‹œκΈΈ λ°”λž„κ²Œμš”πŸ”₯

@dkswnkk dkswnkk merged commit 879a79e into next-step:albertimkr Feb 13, 2025
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