Skip to content
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

Why are there 2 classes that are exactly the same #2

Open
linxydmhg opened this issue Mar 23, 2018 · 1 comment
Open

Why are there 2 classes that are exactly the same #2

linxydmhg opened this issue Mar 23, 2018 · 1 comment

Comments

@linxydmhg
Copy link

This is a question, not an issue. I'm curious, why are there 2 classes that have exactly the same signature: MoviesRepository and MoviesDataStore here: https://github.com/mrsegev/MovieNight/tree/master/domain/src/main/kotlin/com/yossisegev/domain

Is this a standard approach by duplicating the class? I imagine if you had a very large project with lots of models and methods it would become a bit confusing..

@Lewiscowles1986
Copy link

You're going to kick yourself when you see this https://github.com/mrsegev/MovieNight/blob/089768c55cb26281a08812f3d65e315fa26b2422/data/src/main/kotlin/com/yossisegev/data/repositories/MoviesRepositoryImpl.kt

Essentially the repository delegates to the datastore in a factory-ish way. Whilst it's not imperative they share the same signatures, it probably made writing by one person easier.

In a team environment, this is less likely to happen. Also if you reduced to a single signature, you'd never know if people were binding to the data store directly (what the repository is designed to stop happening so you can switch stores / store implementations).

There is a great write-up, which is how I got here, which seems to cover this https://proandroiddev.com/a-guided-tour-inside-a-clean-architecture-code-base-48bb5cc9fc97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants