clean-architecture

Executing rx.Obseravables secuentially

心已入冬 提交于 2019-12-12 02:33:38
问题 I'm developing an Android App using Fernando Ceja's clean architecture. One of my Interactors or Use Cases is in charge of getting the User's feed data. In order to get the data, first I have to retrieve the User's Teams from a database table and then I have to get the Feed list from the server-side. This is how I get the Teams from the database layer: mTeamCache.getAllTeams().subscribe(new DefaultSubscriber<List<SimpleTeam>>() { @Override public void onNext(List<SimpleTeam> simpleTeams) {

Implement Room with RxJava and Retrofit

白昼怎懂夜的黑 提交于 2019-12-11 06:19:21
问题 I am trying to use Room with RxJava and Retrofit, Before You recommend use a component arch (In this opportunity is not possible, the project is in and 50% and Just need to continue with the arch clean). So the problem is this. I have a web service that returns a POJO . Something like this: { "success":"true", "message":"message", "data":{[ "id":"id", "name":"name", "lname":"lname", ]} } POJO is more complex but for the example is ok with this. I need to do that since my view make query to

The Clean Architecture, usecase dependencies

霸气de小男生 提交于 2019-12-10 18:18:58
问题 Recently, I found my way to The Clean Architecture post by Uncle Bob. But when I tried to apply it to a current project, I got stuck when a usecase needed to depend on another usecase. For example, my Domain Model is Goal and Task. One Goal can have many Tasks. When I update a Task, it needs to update the information of its parent Goal. In other words, UpdateTask usecase will have UpdateGoal usecase as a dependecy. I am not sure if this is acceptable, or, if we should avoid usecase level

Why does Clippy suggests passing an Arc as a reference?

会有一股神秘感。 提交于 2019-12-10 13:33:10
问题 I am checking Clippy findings in my code and found that the pedantic rule needless_pass_by_value might be a false positive. It says that: warning: this argument is passed by value, but not consumed in the function body help: consider taking a reference instead: &Arc<Mutex<MyStruct>> Since cloning the Arc is only reference counting, moving the Arc should not be bad idea. Does it really make any difference in terms of quality and performance to send a reference instead of a value for the Arc ?

Clean Architecture: Combining Interactors

你说的曾经没有我的故事 提交于 2019-12-08 15:44:06
问题 I've recently stumbled upon Clean Architecture, by Uncle Bob, and I'm curious to know whether Interactors can execute other Interactors. For example, these are my Interactors as of now: getEmptyAlbums, getOtherAlbums. Both have Callbacks that return with a list of Albums (An ArrayList of an Album model) respectively. Am I allowed to have an Interactor called getAllAlbums that executes the previous two Interactors within it's run block? @Override public void run() { getEmptyAlbums.execute(); }

Clean Architecture, UseCases and Entities

落爺英雄遲暮 提交于 2019-12-06 16:50:31
Okay, so I just started a new Android project and wanted to try implementing the Clean Architecture by Uncle Bob. I have a nice beginning using RxJava and stuff from GitHub samples & boilerplates and Fernando Cerjas' blog (like this article ), but still have some questions on how to implement some UseCases. TL;DR Should an Entity have fields that are another Entity (in my example, User having a List<Messages> field)? Or should the Presenter combine UseCases to build a ViewModel mapped on multiple Entities (then how to you code the mapper?)? Or should the Presenter have a ViewModel associated

Dependency from Gateway to Framework in Clean Architecture

放肆的年华 提交于 2019-12-06 07:44:08
Let's imagine I would want to implement an ASP.NET application based on Uncle Bobs Clean Architecture. As far as I understood it: Asp.Net itself would be in the framework circle An Asp.Net controller would be in the gateways/interface adapters layer my business logic would be in the usecases/entities layer The dependency rule says only dependencies from outer circles to inner circles are allowed. As i understood it the dependency rule is not just about control flow but about code level dependencies in general. BUT: in order to have an Asp.Net controller in the "gateways" circle it would have

Using clean MVP on android with RxJava: How can you keep the presenter free of any android knowledge while still observing on the UI thread?

孤街醉人 提交于 2019-12-06 04:13:26
问题 In an effort to implement 'clean' architecture on android with the mvp pattern it is advised to treat the android framework as a plugin and not leak any android aware dependencies into the presenter layer. Using rxjava, if I have a presenter that is designed to 'push' data to the view layer I may want to have logic like this: public interface SearchPresenter { interface ViewLayer { void updateResults(List<SearchResult> searchResults) } void bind(ViewLayer viewLayer); void unbind(); } public

How to share dependencies in a Modularized Android App

戏子无情 提交于 2019-12-05 03:59:05
I have an Android project which is architectured in a Modularized way. I have modularized the projects by dividing their source code between multiple Gradle modules, following the clean Architecture . Here is the structure of the App. The top module in this hierarchy, App is the one that no other module depends upon, is the main module of your application. The lower level modules domain and data do not depend on the App module, where the App module includes the data and domain modules. I have added the below code in the build.gradle of the app module implementation project(':domain') api

Using clean MVP on android with RxJava: How can you keep the presenter free of any android knowledge while still observing on the UI thread?

六月ゝ 毕业季﹏ 提交于 2019-12-04 09:46:12
In an effort to implement 'clean' architecture on android with the mvp pattern it is advised to treat the android framework as a plugin and not leak any android aware dependencies into the presenter layer. Using rxjava, if I have a presenter that is designed to 'push' data to the view layer I may want to have logic like this: public interface SearchPresenter { interface ViewLayer { void updateResults(List<SearchResult> searchResults) } void bind(ViewLayer viewLayer); void unbind(); } public class SearchPresenterImpl implements SearchPresenter { ViewLayer viewLayer; CompositeDisposable