Android-CleanArchitecture-Kotlin icon indicating copy to clipboard operation
Android-CleanArchitecture-Kotlin copied to clipboard

Code packages

Open rendecano opened this issue 7 years ago • 12 comments

Any reason why you moved away from data/domain/presentation packages for each feature?

rendecano avatar Feb 14 '18 03:02 rendecano

...or why the features themselves don't have additional packaging.

Zhuinden avatar Feb 14 '18 04:02 Zhuinden

waiting for the response......

Thansoft007 avatar Feb 17 '18 18:02 Thansoft007

Strange... Why the project to not have three layers?

St4B avatar Mar 31 '18 16:03 St4B

Have you ever tried to make an instant app with top-level data/domain/presentation packages?

Zhuinden avatar Mar 31 '18 16:03 Zhuinden

How an instant app is affected by the different packages?

St4B avatar Mar 31 '18 17:03 St4B

You have to repackage the whole thing to have top-level modules by features, so having a single presentation package with adapters/activities is super bad.

So having a features package is much better, although personally I prefer to only cut presentation layer to features. I like the Buffer package structure: https://overflow.buffer.com/2016/09/26/android-rethinking-package-structure/

Zhuinden avatar Mar 31 '18 17:03 Zhuinden

Hey all! There was some big refactor. I wrote a post about it, please check it out: https://fernandocejas.com/2018/05/07/architecting-android-reloaded/

Any feedback is more than welcome!

android10 avatar May 09 '18 19:05 android10

As mentioned by @Zhuinden , is it possible to cut the presentation layer into features and keep the domain/data part into a separate package? In this way, we can really still easily extract and reuse the common use cases and maybe create some sort of SDK?

In addition, what do you guys think about using the "feature module(s)" to support Android Instant App?

Comments are welcome. :)

rendecano avatar May 10 '18 00:05 rendecano

@rendecano As an option we can keep only common use cases in separate package or module. Usually the number of common use cases are relatively small.

"SDK" is like an Network Service or other API, it need to be hided from domain and presentation layers and accessed from Repository only or Repository -> Use Case ))

ghost avatar May 10 '18 04:05 ghost

I think the split by feature is wrong here. The split is by contexts (login/movie/settings) then we can split by features (login, logout, see all movies, see movie detail, ...). In this case, you can use 1 module by context.

  • contexts
    • movie
      • list
        • Activity/Fragment/UiModels/...
      • detail
      • endpoint
        • Repo/DataModels
    • login
      • login
      • logout

m-maillot avatar May 14 '18 07:05 m-maillot

It's still modules over packages right ? It seems having separate modules like in previous project would be better since it will work really well with new bundle style distribution on Google Play.

melihaksoy avatar May 14 '18 08:05 melihaksoy

Modules are fine and that is the idea when you scale this project. Previously modules were telling you stuff about the architecture of the framework but it did not scale well actually when adding more and more features since every each of those would depend on the 3 layers (modules).

The idea of modularization is to be feature specific where you can plug and unplug features depending on your needs.

android10 avatar May 17 '18 08:05 android10