Simple&Natural

Remote와 Local DataSource의 Model설계 방법에 관하여 본문

안드로이드(Android)/학습자료

Remote와 Local DataSource의 Model설계 방법에 관하여

Essense 2020. 10. 26. 22:32
728x90

최근 프로젝트를 진행하며 막혔던 부분이었는데

Local과 Remote를 DataModel을 분리할지 아니면 동일하게 가지고 갈지

이에 대해 나 말고도 많이들 비슷한 고민을 가지고 있는 것 같다.

 

이에 대해 좀 더 경험있는 개발자들의 조언은 분리하라는 것이다.

간단한 구조에서는 별 문제가 없을지 모르지만

데이터가 점점 복잡해지고 프로젝트 규모가 커지면 어쩔 수 없이 두 모델을 분리해야 하는 상황이 온다는 것.

 

아래의 댓글에서도 이와 같이 설명하고 있다.

설계로 고민하는 경우 참고하는 게 좋을 듯

 

 

github.com/android/architecture-components-samples/issues/388

 

Same model for both Retrofit and Room · Issue #388 · android/architecture-components-samples

Is it a correct pattern to use a same model for both Retrofit and Room library as it's done in GithubBrowserSample sample?

github.com

github.com/square/moshi/issues/453#issuecomment-368563445

 

Exclusion without Transient · Issue #453 · square/moshi

Is there any (hopefully somewhat simple) way to exclude fields in Kotlin without using @Transient? I am using ObjectBox for persistence and it utilizes different types for relationships, currently ...

github.com

 

728x90