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

기차 충돌(train wreck) 제거(디미터법칙 만족) #53

Open
2 of 4 tasks
Dae-Hwa opened this issue Sep 3, 2021 · 2 comments
Open
2 of 4 tasks

기차 충돌(train wreck) 제거(디미터법칙 만족) #53

Dae-Hwa opened this issue Sep 3, 2021 · 2 comments

Comments

@Dae-Hwa
Copy link
Collaborator Author

Dae-Hwa commented Sep 3, 2021

RequestHandler

Request

  • getContentLength
  • Request.from(requestMessages.toString());
    • toString으로 넘기는게 좀 어색해보임
    • RequestBuilder 생성
  • request.isResource || request.isHtml
  • request.getRequestMessage().getParameters();
    1. parameters를 바로 가져온다.
      • 이 것도 결국 내부의 데이터 가져와서 쓰는거라 별반 차이가 없음.
    2. UserBuilder랑 Request를 연결시켜주는 매개체를 만든다.
      1. RequestParser.parse(User.class)
        • 리플랙션을 써야돼서 구현이 오래 걸릴 수 있음
      2. 그냥 새로 만들어준다.
        • UserRequestMapper.map(Request, User)
        • LoginRequestMapper

최종적으로 request.getMessage가 없어져야함.

@sanhee
Copy link
Owner

sanhee commented Sep 7, 2021

기차 충돌을 중점으로 생각했는데, 아래 2가지가 나왔어요.
프레디가 도출해 낸 리팩토링 목록의 부분집합이네요ㅋㅋㅋㅋ..

  1. header 클래스에서 content-length를 바로 가져올 수 있는 메서드가 있다면 깔끔할 것 같습니다.
    • requestHeader.getContentLenth();
requestHeader.getAttributes().getOrDefault("Content-Length", "0")
  1. request.getParameters() 및 parameters를 일급 컬렉션으로 만들면 좋을 것 같습니다.
    • 나중에 파라미터를 조작하는 메서드가 필요하지 않을까? 생각해서 상태와 행위를 모아둔 일급 컬렉션을 생각 했습니다.
Map<String, String> parameters = request.getRequestMessage().getParameters();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants