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

[MVC 미션 1단계] 오션(김동해) 미션 제출합니다. #358

Merged
merged 6 commits into from
Sep 14, 2023

Conversation

e-astsea
Copy link
Member

안녕하세요 쥬니쥬니~

MVC 미션 1단계를 구현해보았습니다!
미리 쥬니의 빠르고 좋은 리뷰 감사합니다~

Copy link

@cpot5620 cpot5620 left a comment

Choose a reason for hiding this comment

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

반갑습니다 🌊 ~

1단계 요구 사항은 모두 충족하신 것 같아서, approve 하도록 하겠습니다.

코멘트 몇 개 남겨두었는데, 2단계 진행하시면서 반영 혹은 의견 남겨주시면 감사하겠습니다.
2단계도 화이팅입니다 🔥

Comment on lines 31 to 37
public void initialize() {
log.info("Initialized AnnotationHandlerMapping!");
final Reflections reflections = new Reflections(basePackage);

final Set<Class<?>> controllerClasses = reflections.getTypesAnnotatedWith(Controller.class);
controllerClasses.forEach(this::makeHandlerExecutions);
}

Choose a reason for hiding this comment

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

로그의 위치가 바뀌어야 하지 않을까요 ?

아래 코드가 수행되던 와중에, 예외가 발생하더라도 성공했다는 로그가 찍힐 것 같아요 ~

Copy link
Member Author

Choose a reason for hiding this comment

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

그럴 것 같아요 ! 놓쳤던 부분이라 2단계에서 수정하겠습니다~

Comment on lines +52 to +57
private Set<Method> getRequestMethod(final Class<?> controller) {
return Arrays.stream(controller.getDeclaredMethods())
.filter(method -> !method.isSynthetic())
.filter(method -> method.isAnnotationPresent(RequestMapping.class))
.collect(Collectors.toSet());
}

Choose a reason for hiding this comment

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

  1. isSynthetic()을 통해 필터링 한 이유가 무엇인가요 ?

  2. 추출한 메서드들의 파라미터 / 반환 타입 정도는 추가 검증해보는 것이 어떨까요 ?

  3. Collectors.toList()를 사용해도 무방했을 것 같은데요. Set 자료구조를 사용하신 이유가 있을까요 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. 모든 메소드를 가져오는 방식에서 애초에 Synthetic한 것만 가져와서 진행하려고 하였스빈다.
  2. getDeclaredMethods로 가져온 파라미터/반환 타입을 검증하자는 것일까요 ?
  3. 굳이 순서를 보장할 필요가 없다고 생각했고 O(1)으로 set이 탐색속도가 더빠르다고 생각했습니다.

Comment on lines +76 to +78
private HandlerExecution getHandlerExecution(final Object instance, final Method method) {
return new HandlerExecution(instance, method);
}

Choose a reason for hiding this comment

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

해당 메서드를 분리할 필요가 있었을까요 ㅎㅎ ?

Copy link
Member Author

Choose a reason for hiding this comment

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

굳이 필요없는 메소드 분리를 진행한 것 같네요 !

Comment on lines 80 to 84
private void addHandlerExecution(final List<HandlerKey> handlerKeys, final HandlerExecution handlerExecution) {
for (HandlerKey handlerKey : handlerKeys) {
handlerExecutions.put(handlerKey, handlerExecution);
}
}

Choose a reason for hiding this comment

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

다른 코드에서 처럼, 여기서도 Collection의 forEach를 사용하는 것은 어떨까요 ?

@cpot5620 cpot5620 merged commit e603d66 into woowacourse:donghae-kim Sep 14, 2023
1 check failed
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