woowacourse-teams / 2022-pickpick

🐹 사라지는 Slack 메시지, 우리가 주워줄게!
https://jupjup.site
72 stars 6 forks source link

refactor: 메시지 text에서 멘션 아이디를 대체하는 부분 리팩토링 #693

Closed JangBomi closed 1 year ago

JangBomi commented 1 year ago

요약

메시지 text에서 멘션 아이디를 대체하는 부분 리팩토링



작업 내용

메시지 text에서 멘션 아이디를 대체하는 부분 리팩토링



참고 사항

아직 미완이지만 기록해야할 부분이 있어서 Draft로 PR 올립니다.

현재 코드

현재 코드의 장점

현재 코드의 단점

멘션 아이디를 닉네임으로 대치하는게 AOP로 뺄만한 기능일까?

이 부분은 이전에 연로그가 닉네임 대치가 AOP로 뺄만한 기능인가? 라고 이야기해줘서 좀 더 깊게 고민해볼 수 있었어요. 공통 로직과 횡단 관심사의 관점으로 봤을 때 각 Service가 아래 그림에서의 핵심 로직이고, 멘션 아이디를 대체하는 로직은 핵심로직을 관통하는 횡단관심사라고 생각했어요. MessageService, ReminderService, BookmarkService 의 각 find() 또는 findOne() 메서드의 관심사는 Request에 넘어오는 조회 조건에 맞게 조회하는 것 이지, 텍스트의 멘션 아이디를 닉네임으로 대치하는 것은 핵심 관심사가 아니라고 생각이 들었고, 횡단 관심사로 뺄 수 있는 영역이 아닐까? 라고 생각했어요.

image

너무 멘션아이디를 Aspect로 보는 관점에 매몰되어있나? 싶어서 Aspect를 사용 안하고 제네릭 없이 최대한 중복 로직 제거한 버전제네릭 사용하고 중복 로직 제거한 버전 (각 브랜치에 ReminderService쪽 보시면 가장 보기 편할 것 같아요!) 도 구현해보면서 어떤 방법이 가장 좋을까 고민해봤을 때도 멘션아이디를 대체하는 부분은 횡단관심사라는 생각이 들었습니다!

아무튼 그래서 이 코드의 개선 방향은

Draft PR이고 아직 리플렉션 적용해보기 전이지만 혹시라도 의견 있으시다면 코멘트로 남겨주세요!! 바쁘실텐데 감삼당 🙇‍♀️



관련 이슈



github-actions[bot] commented 1 year ago

Unit Test Results

235 tests   235 :heavy_check_mark:  15s :stopwatch:   89 suites      0 :zzz:   89 files        0 :x:

Results for commit 60123b30.

:recycle: This comment has been updated with latest results.

pickpick-sonarqube[bot] commented 1 year ago

Passed

Analysis Details

1 Issue

Coverage and Duplications

Project ID: woowacourse-teams_2022-pickpick_AYKprLeNXDQxKhlck1fc

View in SonarQube

JangBomi commented 1 year ago

위의 개선방향에 적은대로 리팩토링 완료했습니다. 😊

pickpick-sonarqube[bot] commented 1 year ago

Passed

Analysis Details

7 Issues

Coverage and Duplications

Project ID: woowacourse-teams_2022-pickpick_AYKprLeNXDQxKhlck1fc

View in SonarQube

pickpick-sonarqube[bot] commented 1 year ago

Passed

Analysis Details

5 Issues

Coverage and Duplications

Project ID: woowacourse-teams_2022-pickpick_AYKprLeNXDQxKhlck1fc

View in SonarQube

pickpick-sonarqube[bot] commented 1 year ago

Passed

Analysis Details

4 Issues

Coverage and Duplications

Project ID: woowacourse-teams_2022-pickpick_AYKprLeNXDQxKhlck1fc

View in SonarQube