GithubHelp home page GithubHelp logo

bufferapp / android-clean-architecture-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
3.6K 146.0 522.0 3.52 MB

An android boilerplate project using clean architecture

License: MIT License

Kotlin 100.00%
android android-application android-architecture clean-architecture android-development android-boilerplate boilerplate buffer

android-clean-architecture-boilerplate's People

Contributors

albodelu avatar grepx avatar hitherejoe avatar jawnnypoo avatar ldhnam avatar lekaha avatar meisolsson avatar ravidsrk avatar shikherverma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-clean-architecture-boilerplate's Issues

Useless @Inject in `BrowseBufferoosPresenter`

Hello!

Once again thank you for this project.

I've realised you are using @Inject constructor' to the BrowseBufferoosPresenterIs this gonna be neccesary somewhere? I mean, you're well providing the presenter dependency from theBrowseActivityModule. You'll never be able to inject the presenter withouth its module because the BrowseBufferoosContract.View` has to be provided through a module.

Regards!

what is the purbose of BufferooCache and BufferooRemote interfaces?

I hit this confusion at first when I'm reading BufferooDataStoreFactory and this is because the class depends on both BufferooCache and BufferooCacheDataStore, where I think it could only depends on BufferooCacheDataStore. we can access the BufferooCache instance from it, to be able to use isCached() or isExpired()
and my last question wouldn't be better to just define remote and cache requirements on DataStore interfaces and removing BufferooCache and BufferooRemote ? .. I think this will make things simpler.

what is the purpose of BufferooCache and BufferooRemote?

Gradle dependencies don't get warnings about new version

I have implemented the gradle dependency template from the project and after a while I noticed that you dont get prompted anymore about new versions. AS doesn't recognise the patterns since it is broken down to multiple variables. Is this something we will have to learn to ignore or is there a way to make it work again without reverting to hardcoded dependencies?

Will the presentation models always be useless?

Hello there. I was thinking after seeing a lot of repositories that usually the presenter or viewModel maps the domain models to presentation (there are no UI models) but this has a lot of problems (I shouldn't reference any platform resource, jetpack compose, etc). Even thinking in multiplatform this can be a huge problem.

Then I found this repo where I can see that the UI is separated from presentation so this problem is solved. But then I thought that really the presentation models will be the same than domain models.

Why should I keep the presentation models instead of using domain models directly until I reach the UI layer?

[QUESTION] How to use this boilerplate properly?

Thank you for creating this awesome project and the lovely documentation and art!

I am worried about the best way to include or start a derived professional app using AL 2.0.

I know the licenses are compatible, but I would like to do it correctly and don't delete the docs.

So new developers that continue the project understand the architecture easily and check changes.

I want to avoid starting from scratch, so I would like to:

  • Move the license.txt and readme.md to a documentation folder and link to it from the new one.
  • Rename packages.
  • Include the buffer sample temporarily until I finish my tested alternative.
  • Delete buffer*-related code.
  • Create proper credits to Buffer in documentation folder or a better and recommended place.

I am going to use this project in my personal apps, but I am worried about apps for clients.

I am planning to contribute so guidelines about style and this topic would be appreciated.

What purpose in setPresenter() method inside View wich has injection of that's presenter

override fun setPresenter(presenter: BrowseBufferoosContract.Presenter) {

Hello, I figured that you set presenter in BrowseActivity using dagger injection and method setPresenter() which I think would be redundant becouse of using dagger. Maybe you can correct me, if I'm mistaken.

Also I'm pretty excited about this article with new vision of clean architecture, and your second topic with new architecture components from google is good too. Nice work!

Where do WorkManager, JobScheduler Fit?

Usually, in apps, there are some tasks that we run in the background, such as syncing of data, analytics etc. Google suggested to use deferrable components such as WorkManager and JobScheduler in such instances.
Where do these components fit in Clean Architecture?

Presentation Gradle has wrong rootProject.ext

Presentation gradle has :

def presentationDependencies = rootProject.ext.cacheDependencies
def presentationTestDependencies = rootProject.ext.cacheTestDependencies

but I guess that this has to be something like :

def presentationDependencies = rootProject.ext.presentationDependencies
def presentationTestDependencies = rootProject.ext.presentationTestDependencies

Also in dependencies.gradle, presentationDependencies has to be changed to provide only the necessary libraries.

AndroidTest mobile-ui, java.lang.NoClassDefFoundError - Android KitKat

Hi,

Thank you for such interesting project sample.

There seems to be a problem with androidTest from mobile-ui module. It doesn't seem to work on KitKat version of OS.

java.lang.NoClassDefFoundError: org.buffer.android.boilerplate.ui.test.TestRunner$onCreate$1
at org.buffer.android.boilerplate.ui.test.TestRunner.onCreate(TestRunner.kt:14)

The missing class occurs to be RxJavaPlugin class.

Domain Layer Mapping

The layer defines the Bufferoo class but no mapper. This is because the Domain layer is our central layer, it knows nothing of the layers outside of it so has no need to map data to any other type of model.

Is there a detailed reason why the Domain Has no Mappings?
wouldn't a Bufferoo fetched from an external source need to be mapped to a Bufferoo in the domain?

Separate Module for Injection

Looking at the diagram it seems like Mobile-UI depends only on presentation module. When I actually dived into the code, that is not really the case. Mobile-UI depends on 4 out of 5 modules in the project. As far I could understand the necessity of other modules except the presentation one is because of the injection package we have inside Mobile-UI module.

What I was curious about is that if we could make different module for injection which will depend on all modules and providing the necessary injection required for each module. Doing that we can limit the usage of modules other than presentation from Mobile-UI modules. Which will also separate the concerns in a good day.

Questions about the architecture

The use cases assume the caller is also the receiver of the data. In most cases, the presenter will call the use case and wait for the result to return for display purposes.

This is mostly true but there are circumstances when it is not what is wanted. For example, my app has chat functionality which uses a websocket. Incoming messages from the server are received in a Socket class in my data module. I could call a use case to deal with it but (a) it seems dirty that such a low level class is using a use and (b) the result of the use case should notify the presenter (if running) about the event.

Any ideas how to deal with this?

Another issue is that by default, the presenter is running on the UI thread so returning data is also on the UI thread (enforced by the use case infrastructure). However, further processing such as domain model to view model can be required and it would be done on the UI thread by default.

Maybe the thread management should remain with the presenter and the use case is oblivious?

Useless BrowseActivitySubComponent

Hello guys !!

I've seen that BrowseActivitySubComponent is not used and only makes the dependency injection with Dagger harder to understand.

Maybe we can remove this file.

Thanks for this amazing project.

LastCacheTime will be updated even if data is accessed from CacheDataStore?

I think there is some problem here. If I understand it correctly when the factory.retrieveDataStore() returns the BufferooCacheDataStore then this code is just taking the data from the cache and again storing it in the cache and updating LastCacheTime.

This does not feel right. Is this intended behavior or some sort of issue?

DataStore question

Hi, i have a question. Why did you introduce DataStore classes, instead of using DataSource itself?

What is the gain of adding one more abstraction, DataSource is already interface and Repository would not be depended on Implementation any way?

Kotlin coroutines

If you were to implement the same framework in Kotlin coroutines instead of using RxJava2 to avoid callbacks (onSuccess, onError) from presenter, how will you do it? Just curious.. :)

Cheers,

Ren

Unused `unsubscribe` method on `CompletableUseCase`

It looks like we're just creating an empty disposable in this class and disposing of it in unsubscribe without ever changing its value. In the SingleUseCase class, we pass an observer into the execute method and capture a reference to the subscription by subscribing inside of thhat method. I would have expected the same to happen in this class, or if the idea is that we subscribe manually from our presenter, shouldn't we also unsubscribe manually and remove this unsubscribe method altogether?

abstract class CompletableUseCase<in Params> protected constructor(
        private val threadExecutor: ThreadExecutor,
        private val postExecutionThread: PostExecutionThread) {
    // Here we initialize subscription as an empty disposable
    private val subscription = Disposables.empty()
    protected abstract fun buildUseCaseObservable(params: Params): Completable

    // I would have expected an observer to be passed into execute so that we can
    // subscribe in this method and obtain a reference to the subscription 
    fun execute(params: Params): Completable {
        return this.buildUseCaseObservable(params)
                .subscribeOn(Schedulers.from(threadExecutor))
                .observeOn(postExecutionThread.scheduler)
    }

    // Now we unsubscribe from our empty disposable
    fun unsubscribe() {
        if (!subscription.isDisposed) {
            subscription.dispose()
        }
    }
}

How to add a child fragment?

I want to add a child fragment to my fragment, but I can not figure out how to do it. Is there some body can help me ? Pleazzzzzzz

Refreshing Coroutines,Flow, KMM,Compose

Well, let's start with Coroutines instead of RXJava2. Hey joe I got a job with your Caster course on Clean Architecture, so I would like to give back, now that have two years and half real working experience, if someone is in to review the code I am all in to contribute to your project, as I read on twitter you want to give it but do not have time to work on that.

How can I fetch the data from cache when fetching data from remote failed?

Hi, I'm new on Clean architecture and we are planning to convert our project(MVP) to Clean architecture and I'm making POC project from our code base and see how it goes for my team.

as the sample code, the data fetch from the cache only the cache not expired or cached in our case is fetch the data from cached when fetching the data from network failed whatever case.

Any ideas?

Wrong comment on `SingleUseCase.kt`#45

First of all, congratulations for this fantastic project.

This is an easy one: The comment I mentioned is wrong. It seems that it's been copied from method fun dispose()

Regards,

Javi.

Domain layer and Application layer separation

Hi, one question related to domain project/module...
Can you explain a little bit more what is a reason that use-cases and domain logic are in
the same module, shouldn't it be more appropriate to separate use-cases to application layer
and domain entities with all their logic to domain layer... This way the domain layer is
shareable as enterprise-wide rules....

More on stackexchange: Application layer vs Domain layer

Architecture question

According to this talk : https://www.youtube.com/watch?v=Nsjsiz2A9mg
Uncle bob says that a project's structure should not be MVC or MVP, MVVM...,
But this project top structure is mobile-ui/presentation/domain/data...,
Programmers cannot know what is this app doing at first glimpse, could you tell me what do you think about this? I am so confused. Thank you!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.