-
Notifications
You must be signed in to change notification settings - Fork 1
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] 출발지 모드 세팅 / Enum Class 활용 #272
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/runnect/runnect/util/DepartureSetMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.runnect.runnect.util | ||
|
||
enum class DepartureSetMode(val mode: String) { | ||
SEARCH("searchLocation"), | ||
CURRENT("currentLocation"), | ||
CUSTOM("customLocation") | ||
} |
Oops, something went wrong.
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.
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.
SEARCH, CURRENT, CUSTOM 뒤에 붙는 .mode가 불필요하게 코드를 길어지게 만들어 조금 거슬리는 느낌도 들었습니다.
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.
enum 클래스를 사용하면 관련된 상수들을 집합처럼 묶어서 관리할 수 있으므로 가독성이 올라갈 것이라고 생각했습니다!
음 현재 DepartureSetMode 클래스에 mode 라는 변수가 꼭 필요한가요?? 아래처럼 이넘 클래스를 구현하면 중복되는 코드가 줄어들 거 같습니다!
참고로 이 블로그 글을 읽어보면, 상수와 관련된 변수나 함수의 관리를 일원화 할 수 있다는 점에서도 enum class 사용을 권장하는 거 같습니다!
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.
링크 감사합니다! 제가 enum 클래스 안에 변수를 만들어준 이유는, 분기처리가 searchResult.mode란 값에 따라 이루어져야 하기 때문입니다. enum 클래스에 어떠한 변수 값 할당 없이 이걸 구현할 수 있나요?!
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.
위의 코드에서 mode 타입을 String 대신에 DepartureSetMode 타입으로 선언하면 되지 않을까 싶습니다!
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.
이 부분 예전에 mode라는 속성이 이 data class 안에 같이 포함되는 게 부적절해보인다고 같이 얘기나눴어서 #274 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.
넵 동의합니다! 관련 코드에 대한 리뷰 #274 PR에 코멘트로 남겨뒀습니다!