clean-architecture

Android app clean architecture: Should data layer have its own model classes?

空扰寡人 提交于 2020-08-02 04:27:05
问题 What´s the best approach when developing an Android app and trying to follow clean architecture guidelines (but not extremely strict - cause that may be overkill for smaller projects). In my case, I am unsure which approach is the best (if there is a best one) regarding the data layer and if the data layer should operate on its own model classes or if it may operate directly on the domain layer models. Also, if the data layer should operate on its own model classes, should data sources like

Clean architecture - where to put input validation logic?

梦想与她 提交于 2020-07-05 11:43:01
问题 Perhaps in the app I have a feature allowing users to send feedback using a form with some validation logic: name can be empty feedback message should be at least 5 characters Where would you put these validation logic, either in domain layer as business logic or in presentation layer as UI logic? These logic are applied for all applications (android, iOS, web). Please note that we already had server side validation. 回答1: I think many developers do that in Presentation layer, specifically in

Clean architecture - where to put input validation logic?

一曲冷凌霜 提交于 2020-07-05 11:41:05
问题 Perhaps in the app I have a feature allowing users to send feedback using a form with some validation logic: name can be empty feedback message should be at least 5 characters Where would you put these validation logic, either in domain layer as business logic or in presentation layer as UI logic? These logic are applied for all applications (android, iOS, web). Please note that we already had server side validation. 回答1: I think many developers do that in Presentation layer, specifically in

retrofit interceptor on different module in feature-based clean-architecture android

帅比萌擦擦* 提交于 2020-05-16 21:58:12
问题 I've been learning clean architecture with refrence to this-sample and some others, with which I just created a base module, such that all the modules in my project must be implementing it. Here I keep all the Utility classes as well. It helped me a lot to be lazy on basic project setup for dagger, retrofit, etc. I thus got faster easy way on diving into the clean-architecture with feature-based modules. I've managed my project files in this manner. The main problem I faced with this

How to properly separate Realm from the rest of the app?

和自甴很熟 提交于 2020-01-16 11:26:11
问题 In my app I am trying to use MVVM with repositories databases and all that. I like to keep all my external dependencies and such separate and compartmentalized into their own files/modules so that they can easily be replaced or swapped out. With Realm I could make this work really well by using unmanaged objects. I can have a RealmHelper class for example which just opens a realm instance, queries or performs some transaction and then closes the realm and returns an object. So how can I

Clean Architecture: Which layer for in-memory entities?

。_饼干妹妹 提交于 2019-12-25 00:22:52
问题 considering the different layers of clean architecture by uncle bob i have a question: if you have your data stored, say in a database, this is obviously a detail so the database goes into the outward layer (framework & drivers). The entities however that describe the data in that database are the core information of my app, so they go in the most inner layer (entities). Now let's say i have to get all of the data at start of the application. Then there is some computation that is only needed

Clean Architecture, UseCases and Entities

你离开我真会死。 提交于 2019-12-23 01:36:08
问题 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

How to share dependencies in a Modularized Android App

拟墨画扇 提交于 2019-12-22 04:19:27
问题 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

Correct approach(design pattern) for update fields in java object

匆匆过客 提交于 2019-12-13 03:49:25
问题 I have java class Person : public class Person { private String name; private int age; private String marriedStatus; private Date dob; //getters and setters } When I get new values for some fields of this object I can update it. But new fields values income in this format: Map<String, String> newValues where key - field number and value - the value of the field. I create this service: public class UpdateService { public Person updateFields(Person targetPerson, Map<String, String> newValues){

How to handle UseCase Interactor constructors that have too many dependency parameters in DDD w/ Clean Architecture?

微笑、不失礼 提交于 2019-12-12 13:18:54
问题 Using DDD w/ Clean Architecture, I'm instantiating all of my dependencies (e.g. Repositories and Services) first and injecting them into my UseCases. What I've noticed over time is that my list of dependencies for each UseCase has grown quite large over time. For example, my UseCase uses 3 Aggregate Roots so I have 3 repositories. Not so bad. But, as I add more features, I find myself adding Domain Services or more Repositories and having to inject them into the UseCase Constructor as well.