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

Question about package stucture #197

Open
japplin opened this issue Nov 26, 2016 · 5 comments
Open

Question about package stucture #197

japplin opened this issue Nov 26, 2016 · 5 comments

Comments

@japplin
Copy link

japplin commented Nov 26, 2016

The purpose of this repo is to demo what using uncle bob's clean coding principles looks like on android but, doesn't the package structure completely go against what he suggests. Packages shouldn't be named presenters or views, MVP is a pattern not a specific part of the application. Instead, I believe that each activity should be in its own package with all of its components(presenter, interactor ...). This also has the benefit of being able to make the presenters package local. What are your thoughts?

@CROSP
Copy link

CROSP commented Dec 3, 2016

@japplin This repo is just an example and possible interpretation of Clean Architecture. You should not follow the same way, this is like understanding of @android10 of Uncle Bob's architecture.

As for naming convention again it depends.
You are trying to achieve something like VIPER in Android world (ViewController)

I try to think of activity as a view. In Android SDK activity is god object, but however its main purpose to display information, so I try to delegate some parts provided by activity to specific component which should be responsible for that, for example Permission Handler, Context...

Your proposal also have a lot of benefits, personally I've used approach of acting Activity as Fragment container and in this case one module contained one activity and a lot of Fragments.

You can implement your idea and share your experience with others, it would be great.

@aldoKelvianto
Copy link

You're right, @android10 has address this in this talk. He said something like,

Do as I say, not as I do

Maybe because primary usage for this repo is to demonstrate Clean Architecture in Android, not a full blown implementation. I've been using your approach for some of my apps and it works fine.

@android10
Copy link
Owner

@aldoKelvianto exactly 😄

@android10
Copy link
Owner

@japplin that can be interpreted in different ways but there is actually a refactor to get rid of the modules and have every feature in its own package. Neither silver bullets nor perfect solution.

Check it out: #103

@Zhuinden
Copy link

Zhuinden commented Mar 5, 2017

@japplin you should separate the initial directories by data, domain and presentation, but you should make sure that you separate presentation layer by features instead of activity/adapter/etc

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

5 participants