Android-CleanArchitecture-Kotlin
Android-CleanArchitecture-Kotlin copied to clipboard
Question: should I always create a "middle" model for the View?
I have seen that you created a MovieView
with the same parameters as the Movie
model, having in mind that the View shouldn't know anything about the models, following the pattern, but, I have a doubt if that can be an overuse of classes, I mean, that's ok to apply the pattern as it is, isolating each layer, but if the app is so big that can be a mess of classes everywhere, is that ok btw?
Maybe this is the reason:
- ModeView implement KParcelable
- fun callingIntent(context: Context, movie: MovieView): Intent { val intent = Intent(context, MovieDetailsActivity::class.java) intent.putExtra(INTENT_EXTRA_PARAM_MOVIE, movie) return intent }
The benefit from doing so, is to be more flexible to future changes. Long-term i believe that you will be benefited by that. Also, in Kotlin is very easy and fast to build immutable pojos (In java, writing getters, setters and implementing builder pattern produces too much boilerplate code). So, I can not think a reason for not sticking with this principle.