Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Refactor] #520 - DateFormatter() 인스턴스 메모리 최적화 #528
base: develop
Are you sure you want to change the base?
[Refactor] #520 - DateFormatter() 인스턴스 메모리 최적화 #528
Changes from 7 commits
eb84af0
293ccab
60dc35a
eccbd90
6911398
106ef65
e52cbce
0cb2153
ffae793
6e4a67c
461370b
35e0a09
502d79d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
서버에서 받아온 날짜 관련 String을
뷰계층에서 from -> to로 바꿔주는 것이군요 :)
서버와 약속한 Date format으로 Date를 변환하는 역할은 누구에게 책임이 있다고 생각하시나요?
저는 해당 책임은 데이터 모듈 혹은 네트워크 모듈이 지녀야 한다고 생각해요.
서버의 문자열 format이 바뀌었을 때 뷰계층 코드를 변경하는 것보단 네트워크쪽 코드를 변경하는 것이 자연스럽다고 느껴지기 때문이에요
Date값이 Data계층에서 Domain계층으로 넘어갈 때 String 값을 Date값으로 변경하고,
Presentation 계층에선 Date -> String으로 변환하는 방식은 어떨까요?
Domain에는 가장 순수한 Date 타입만 존재하면 좋을 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다시 생각해보니 해당 PR은 메모리 성능 최적화가 중점적이라, PR에서 작업하지 않은 내용을 리뷰한 것 같네요 ㅎㅎ;
그래도 같이 고민해보면 좋을 것 같습니다 .. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰 감사합니다 !! 기존 코드 수정에만 집중하다 보니 각 레이어의 역할 분리에 대해 깊이 있게 고민하지 못했던 것 같아요.
석우님 말씀처럼 서버에서 받아온
날짜(String)값
을 Data -> Domain 단계에서 Date 타입으로로 변환하면 UI 상황에 맞게 다양한 포맷으로 변경할 수 있어 더 유연한 구조가 될 것 같네요 ! 리뷰에 함께 반영하도록 하겠습니다👍👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
피드백 수용해주셔서 감사함다 :)
현 구조에선 toDomain()에서 String을 Date로 변환하는 것이 가장 편할 것 같네요.
이외에도 서버의 requestBody의 json을 Decodable 구조체로 디코딩할 때 JSONDecoder의 dateStrategyFormat값을 통해 처음부터 해당 밸류값을 Date 타입으로도 받아오는 방법도 있습니다~!