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

[톰캣 구현하기 - 1,2단계] 모디(전제희) 미션 제출합니다. #327

Closed
wants to merge 7 commits into from

Conversation

jaehee329
Copy link

@jaehee329 jaehee329 commented Sep 4, 2023

안녕하세요 헙크..!
하하 테스트 없이 굴러가는 불안한 코드로 일단 제출합니다!

아직 리팩터링할 부분이 당연히 많은데 3단계에서 추가적으로 고쳐보겠습니다!
큰 흐름에서 제안해주실 사항이나 하면서 좋다고 생각했던 아이디어들 말씀 주시면 수정에 참고하겠습니다~!

@sonarcloud
Copy link

sonarcloud bot commented Sep 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20.1) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@jaehee329 jaehee329 requested review from HubCreator and removed request for HubCreator September 4, 2023 07:20
@jaehee329 jaehee329 closed this Sep 4, 2023
Copy link
Member

@HubCreator HubCreator left a comment

Choose a reason for hiding this comment

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

모디 안녕하세요! 헙크입니다 ㅎㅎㅎ

리뷰하면서 많이 배웠습니다. 구조적인 것과 효율적인 패턴사용이 인상깊었어요. 사실 뭐가 이상하다 말씀드리기가 뭐할정도로 제가 봤을 때는 잘 구현하신 것 같아요.

몇 가지 간단한 커멘트 남겼습니다. 한 번 더 얘기를 나눠보고 바로 Approve하면 될 것 같아요! 고생하셨습니다.

Comment on lines +32 to +42
private void validateRequestLineElementsCount(String[] elements) {
if (elements.length != 3) {
throw new HttpFormatException();
}
}

private void validateUrlAndQueryStringLength(String[] urlAndQueryString) {
if (urlAndQueryString.length > 2) {
throw new HttpFormatException();
}
}
Copy link
Member

Choose a reason for hiding this comment

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

검증!! 꼼꼼하시군요 ㅎㅎㅎ

Comment on lines +20 to +24
for (Handler handler : HANDLERS) {
if (handler.supports(httpRequest)) {
return handler;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

핸들러를 독립적으로 나눈 것이 인상깊네요! 응집도도 더 올라가고 좋은 것 같습니다

Comment on lines +16 to +17
public class MemberService {

Copy link
Member

Choose a reason for hiding this comment

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

오 벌써 레이어드 아키택처라니.. 쏘 쿨


@Override
public HttpResponse handle(HttpRequest request) {
if (doesRequestContainsCookie(request)) {
Copy link
Member

Choose a reason for hiding this comment

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

handler에서 쿠키가 있는지 확인하는 것도 좋지만, HttpRequest 객체에게 쿠키가 있는지 물어보는 것도 좋을 것 같습니다! 쿠키가 있는지 알려주는 것은 HttpRequest의 책임에 조금 더 가깝지 않을까 생각해봤어요 ㅎㅎㅎ


public static HttpResponse register(HttpRequest httpRequest) {
String body = httpRequest.getBody();
Map<String, String> requestParam = parseForm(body);
Copy link
Member

Choose a reason for hiding this comment

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

아마 중간에 GET 요청 방식에서 POST 요청 방식으로 바뀌었는데, 요거 변수명도 같이 안바뀐 것 같네요 ㅎㅎㅎ
이제 requestParam이 아니라 requestBody 어떠신가요!?

Comment on lines +33 to +35
addRequestLine(outputStream);
addHeaders(outputStream);
addBody(outputStream);
Copy link
Member

Choose a reason for hiding this comment

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

아아 outputStream을 넘겨서 쭉쭉 써내려갈 수 있군여... 아니 학습테스트를 했었는데도 새롭네요 ㅋㅋㅋㅋ 배워갑니다 모디 ㅎㅎ

Comment on lines +68 to +69

public static class Builder {
Copy link
Member

Choose a reason for hiding this comment

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

빌더 패턴도 멋져요 ㅎㅎㅎ 저도 적용해야겠네요

Comment on lines +21 to +25
if (handler.supports(httpRequest)) {
return handler;
}
}
return HANDLER_NONE_MATCHED_DEFAULT;
Copy link
Member

Choose a reason for hiding this comment

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

스트림을 사용할 수도 있을 것 같네요

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