-
Notifications
You must be signed in to change notification settings - Fork 301
Step4 #772
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
base: cm0x0x0x0
Are you sure you want to change the base?
Step4 #772
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
미션 진행하느라 고생하셨어요! 👍🏻
몇몇 기능 요구사항에 대해 오해하신 듯 해요. 그리고 도메인 모델이 인프라 레이어와 결합이 발생했네요. 한번 리팩토링해보시겠어요?
} | ||
|
||
public void approve() { | ||
if (this.status == EnrollmentStatus.APPROVED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- this.status.isApproved() 로 메시지를 보내보는건 어떨까요? 그리고 이미 작성한 isApproved() 메서드를 활용해보는건 어떨까요?
|
||
public boolean isEnrolledBy(Member student) { | ||
return values.stream() | ||
.anyMatch(e -> e.getStudent().equals(student)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 값을 꺼내서 비교한다면, 늘 리팩토링 여지가 있지는 않은지 고민해보세요. 여기도 메시지를 보내볼 수 있겠죠??
new PaidJoinStrategy() | ||
); | ||
|
||
assertThat(session.joinable(new Payment(10000L))).isFalse(); | ||
} | ||
|
||
@Test | ||
@DisplayName("강의 상태가 PREPARING이면 모집중이어도 수강 신청 불가") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 강의 수강신청은 강의 상태가 모집중일 때만 가능하다. -> 강의가 진행 중인 상태에서도 수강신청이 가능해야 한다. 입니다.
Session session = new Session( | ||
"강의 준비 중", | ||
1, | ||
LocalDateTime.now(), | ||
LocalDateTime.now().plusDays(7), | ||
0L, | ||
0, | ||
0, | ||
validImages, | ||
SessionStatus.PREPARING, | ||
RecruitmentStatus.RECRUITING, | ||
new FreeJoinStrategy() | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 인자가 너무 늘어났는데요. 규칙 7: 3개 이상의 인스턴스 변수를 가진 클래스를 쓰지 않는다. 를 위반하네요.
public enum EnrollmentStatus { | ||
PENDING, APPROVED, REJECTED; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 강의 진행 상태(준비중, 진행중, 종료)와 모집 상태(비모집중, 모집중)로 상태 값을 분리 입니다.
public class Images { | ||
private List<Image> images; | ||
|
||
public Images(List<Image> images) { | ||
this.images = List.copyOf(images); | ||
} | ||
|
||
public List<Image> getImages() { | ||
return Collections.unmodifiableList(images); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 데이터 홀더 외는 별 다른 역할이 없는걸까요?
if (status == EnrollmentStatus.APPROVED) { | ||
enrollment.approve(); | ||
} else if (status == EnrollmentStatus.REJECTED) { | ||
enrollment.reject(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 도메인 정책이 인프라 레이어에까지 침투했네요
리뷰 잘 부탁드립니다 :)
평소에 자바를 써본적이 없다보니 jdbc 등등의 개념이 어렵네요.. ㅎㅎ