Skip to content

Conversation

@inpink
Copy link

@inpink inpink commented Nov 27, 2023

[시간 제한 관련]

  • 테스트 통과까지 5시간 소요
  • 필수 테스트가 아닌 기능 하나 구현하는데 +20분 초과
같은 레벨에서 이미 페어로 만난적이 있는 크루끼리 다시 페어로 매칭 된다면 크루 목록의 순서를 다시 랜덤으로 섞어서 매칭을 시도한다.
- 3회 시도까지 매칭이 되지 않거나 매칭을 할 수 있는 경우의 수가 없으면 에러 메시지를 출력한다.

 
 
[적용하지 못한 것]

  • IoC Container (이유 : 시간 부족)
  • 모든 메서드 내의 파라미터와 필드에 final 달기 (이유 : 시간 부족)

 
[저번 주 미션에 비해 더 신경쓴 부분]

  • 필요한 데이터를 우선 담는 객체를 생성합니다. 확장성은 시간이 남아 리팩터링할 때 고려해야 시간을 단축할 수 있습니다.
  • 필드의 수를 줄이기 위해 노력했습니다. 위의 항목과도 관련있는데, 피드백해주신 부분을 많이 참고하여 사용되지 않는 데이터는 담지 않으려 했습니다.
  • Mapper에 대한 사용 방식과 규칙이 어느 정도 정립되었다고 생각합니다.
  • 비지니스 로직에 대한 부분은 테스트 코드를 작성하면서 하니 확실히 테스트 코드 작성하는 시간은 들었지만, 오류를 사전에 발견할 수 있어 결국 전체적인 시간은 줄어들었습니다.
  • 테스트 통과가 최우선이라는 생각을 하며 구현하였습니다.

 
[다음 주 미션에 적용하려 하는 부분]

  • 재사용 가능한 템플릿을 세세하게 만들어두려고 합니다. 생각보다 작은 시간이 모여서 큰 차이를 만들어낼 수 있다고 느꼈습니다.
  • 시간을 더 단축해야할 필요성을 느끼고 있습니다.
  • 양심에 조금 찔리지만 기능 목록이 담긴 파일과 커밋을 덜 세세한 단위로 작성한다면 시간을 단축시킬 수 있을 것이라 생각합니다. 문서가 매우 중요하다고 생각하는 사람이지만 이번에 한 것의 반정도로 줄여보려고 합니다. 가독성을 위해 기능 목록을 보기 좋게 정렬하는 등의 행위를 줄여 1분, 5분을 아껴야 함을 느꼈습니다.

 
[다음 미팅에서 함께 얘기해보고 싶은 부분]

  • 하나의 컨트롤러에 모든 흐름을 다 맡기다보니 컨트롤러가 굉장히 비대해졌는데.. 몇가지는 Service로 옮기는 것이 좋을 지에 대해 태호님의 의견이 궁금합니다!

Copy link

@AnTaeho AnTaeho left a comment

Choose a reason for hiding this comment

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

전체적으로 읽어봤습니다!
말씀해주신 controller 가 무거워지는 문제에 대해서는 저도 그렇다고 생각됩니다.

우선 저라면 좀 더 비즈니스 로직을 service 계층에 넘겨주었을 것 같습니다!
그런데 그렇다고 필요없어 보이거나 역할을 너무 벗어나는 로직이 있는 것 같지는 않아서
이 과제 자체가 조금 복잡하지 않았나 생각됩니다.

그 외에도 간단하게 리뷰 남겼습니다! 한번 읽어봐주세요!

}
}

private void processFunctionInput(Function function) {
Copy link

Choose a reason for hiding this comment

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

여기서 분기처리를 해주는 것은 어떤가요?

if(function.is~()) {
    ~~~();
    return;
}

이런식으로요!

지금 방식은 모든 메서드에 다 들어가야해서 가독성이 떨어질 것 같습니다!

}

private void processPairReset(Function function) {
if (function.equals(PAIR_RESET)) {
Copy link

Choose a reason for hiding this comment

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

취향 차이일수 있는데 저는 function에 직접 물어보는 것이 좋다고 생각합니다.
function.isReset() 이런 식으로요!

Comment on lines +105 to +109
private void processRematching(RematchingOption rematchingOption, Course course, CourseMission courseMission) {
if (rematchingOption.equals(YES)) {
processMatchingResult(course, courseMission);
}
}
Copy link

Choose a reason for hiding this comment

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

아니오를 선택하면 코스,레벨,미션을 다시 고르도록 해야하는데,
다시 처음으로 돌아가는 것 같습니다!

Comment on lines +121 to +125
private void processNonDuplicatedResult(CourseMission courseMission, Optional<MatchingResult> nonDuplicatedResult) {
MatchingResult matchingResult = nonDuplicatedResult.get();
outputView.outputPairMatchingResult(MatchingResultMapper.from(matchingResult));
matchingService.save(courseMission, matchingResult);
}
Copy link

Choose a reason for hiding this comment

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

Optional 처리를 service나 repository에서 하는 것이 좋을 것 같습니다!
정확히는 repository에서 Optional을 벗겨서 오는 것이 좋지 않을까 생각합니다!

근거로 JPA Repository의 getById 메서드를 들려고 했는데 Deprecated 됐네요...
그래도 .orElseThrow 같은걸 사용해서 컨트롤러에는 깔끔한 객체를 보여주는 것은 어떤가요?
코틀린처럼 Elvis 연산자가 있으면 좋을텐데 ㅠㅠㅠ

Comment on lines +158 to +165
private Function inputValidFunction() {
return InputUtil.retryOnInvalidInput(this::inputFunction,
errorMessage -> outputView.outputErrorMessage(INVALID_FUNCTION.getMessage()));
}

private Function inputFunction() {
return inputView.inputFunction();
}
Copy link

Choose a reason for hiding this comment

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

private Function inputValidFunction() {
        return InputUtil.retryOnInvalidInput(inputView::inputFunction,
                errorMessage -> outputView.outputErrorMessage(INVALID_FUNCTION.getMessage()));
    }

진짜 큰 차이 아니긴 한데 이렇게 수정하는건 어떤가요?

Copy link
Author

Choose a reason for hiding this comment

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

훨씬 간단해지고 좋네요!! 감사합니다 :)

import java.util.List;
import java.util.Objects;

public class Pair {
Copy link

Choose a reason for hiding this comment

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

아 이생각을 못했네요...
제 코드 보시면 아시겠지만 List<List<Crew>> 이거 진짜 보기 싫었는데
통채로 Pair 객체로 만드려니 그거도 별로여서 안했는데 List<Crew>를 Pair로 묶는게 맞겠네요


public class MatchingController {

private final int REMATCHING_COUNT = 3;
Copy link

Choose a reason for hiding this comment

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

이런 부분에 대해서 저도 고민해봤는데,
3회 체크를 하려면 어쩔수 없이 필드에 값이 존재해야할 것 같았습니다.
하지만 이런 값을을 최대한 배제하려 해서 사용하지 않았는데 이부분에 대해선 어떻게 생각하시나요?

Copy link
Author

Choose a reason for hiding this comment

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

시간이 없어서 분리하지 못했는데..ㅎㅎ 시간 여유가 있었다면 따로 enum에서 관리하는 방법으로 리팩터링 했을 것입니다!

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