Questions tagged [clean-architecture]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
45
votes
3answers
7k views

Using a “Pass-through (God) Service” is bad, right? [duplicate]

My team has developed a new service layer in our application. They created a bunch of services that implement their interfaces (E.g., ICustomerService, IUserService, etc). That's pretty good so far. ...
6
votes
2answers
216 views

What could be a good pattern for a code base that does a lot of A/B testing?

I develop in an environment where we tend to do a lot of A/B testing. I am curious to learn from others on how A/B testing code is managed in your code base? Do you mix your A/B testing code with ...
5
votes
2answers
2k views

Clean Architecture: Dependency Rule and Libraries/Frameworks

In Clean Architecture by Robert C. Martin the dependency rule points strictly from the outermost layer/ring to the innermost. As an example a Dependency Injection Framework should lie on the ...
4
votes
2answers
470 views

Interface Segregation Principle in Clean Architecture

In Chapter 10 of Clean Architecture, Martin gives an example for the Interface Segregation Principle. I have some trouble understanding that example and his explanations. In this example we have ...
4
votes
3answers
263 views

Clean Architecture: Use case spanning multiple UI elements

So I'm currently trying to write a project using Clean Architecture. Its a Unity Engine project which doesn't make the task any easier. The Issue I'm running into however is much more basic and has ...
4
votes
2answers
1k views

Doesn't repository pattern in clean architecture violate Dependency inversion principle?

From what I have read and seen clean architecture assumes that you have some entities which know nothing about persistence though at the same layer as they reside there might be an interface which has ...
4
votes
2answers
1k views

In Clean Architecture, aren't Entities another type of Boundary?

In the Clean Architecture, Uncle Bob defines Entities as enterprise-wide business rules and Interactors (Use Cases) as application-specific business rules. Also, he describes that Interactors are ...
4
votes
2answers
180 views

Inject package protected (internal) classes at runtime

I am referring to Robert C. Martins book "Clean Architecture" on the top of page 318. There he states: In the ports and adapters approach, the OrdersService and Orders interfaces have inbound ...
3
votes
3answers
752 views

Clean Architecture - Where to put business calculations when entities are autogenerated db first efcore?

I'm trying to switch to clean architecture from a traditional layered architecture approach and trying to figure out where to put business logic. Please consider the below scenario - Employee class (...
3
votes
4answers
843 views

How to adapt Clean Architecture to a rich desktop application

I'm just learning about clean architecture and I'm trying to design a proof of concept for an application I want to build soon. In the Clean Architecture the Presentation layer and the Domain Model ...
3
votes
1answer
199 views

Clean Architecture - Should you inject all entity dependencies?

According to "Clean Architecture", should you inject all entity dependencies (should you inject core business logic)? For example, if I have a vector entity, should that entity be injected into all ...
3
votes
1answer
458 views

Clean Architecture: May the Controller talk to the Presenter directly?

From what I understand from the 'Clean Architecture', the controller determines which usecase to execute dependent on the input of the user. If the input from the CLI for example is invalid, the ...
3
votes
2answers
2k views

Clean architecture, CQRS, and authentication?

I'm working on implementing my first clean architecture and CQRS application, I've stumbled across a bit of logic that's leaving me a bit stumped. I'm working on integrating authorization and ...
3
votes
3answers
280 views

Should an interface be defined in the infrastructure layer if it's only used by an implementing class in that layer?

Overview If an application is being developed following a clean architecture / DDD approach, my understanding is that the application core or domain layer should contain classes and interfaces that ...
3
votes
0answers
92 views

data transfer objects between abstraction layers

I want to create an Express REST API and want to try following the clean architecture ideas. I was reading about it but didn't get the idea of the communication between the abstraction layers. Let's ...
3
votes
1answer
111 views

DDD: Type hierarchy of entities' property

Say I have an Delivery class which should have a Destination property (among many others). Destination can be an Address (country, city, address line, post code) or a Port (international code, name). ...
3
votes
0answers
168 views

Clean Architecture - What is the difference between Use Cases and Core Services?

I'm trying to apply Clean Architecture to a simple ASP.NET MVC Core app by following Microsoft's ASP.NET architecture guidelines and their eShopOnWeb sample project. In the standard Clean ...
2
votes
2answers
142 views

How to create useful error messages in a JSON REST API without leaking implementation details across layers?

We're implementing a REST service with three main layers: Controller, Domain, Repository. The REST API is supposed to respond to error conditions with meaningful error messages. Suppose the general ...
2
votes
3answers
938 views

Should business logic be in the app or in the backend?

I've recently started applying the Clean Architecture while developing an Android application. And so I divided my application in 4 different parts. Data layer Contains the implementation of ...
2
votes
3answers
2k views

How to split up use cases in Clean Architecture? (Dealing with use case dependencies)

I am trying to understand Clean Architecture as explained by Uncle Bob. My application requires a user to do a test. A test consists of a collection of questions that a user needs to answer. A audio ...
2
votes
2answers
137 views

Clean Architecture and Persistence Annotations

If one wants to comply with the clean architecture principle 100%, they must not annotate the entities in the entities layer with database-specific annotations (like Hibernate, Neo4j, etc.). So, two ...
2
votes
2answers
75 views

Mantain same entity data in different layers

I'm trying to split the use of a business entity (e.g. a post) thought an application uses, trying to obtain a clean architecture So I will likely have: A class model, where the business logic lives ...
2
votes
1answer
2k views

Clean Architecture and Microservices

Our team is in the planning stages of creating an enterprise solution for our back office. Our goal is to have one singular entry point for common tasks, such as changing an address or reprojecting a ...
2
votes
2answers
430 views

What do I misunderstand about the mediator pattern?

I decided to use Mediator Pattern (with Mediatr) to call my application layer. It's cool and I got how to work with it sometimes, but sometimes I get confused. For example, when we publish a document ...
2
votes
0answers
247 views

Clean architecture - how can a component become a micro service?

I've read and enjoyed the "Clean Architecture" book. So the first thing I tried to do is to implement my project with it. Where I work we follow a design method called IDesign in which the ...
2
votes
0answers
140 views

Clean Architecture Python Example: How to implement a Usecase/Interactor saving Data to a Database

I am struggling with the clean architecure. I have constructed a minimal example of how a usecase/interactor could talk to the database without being dependent on it: The use case: class ...
1
vote
2answers
768 views

Clean Architecture: Is the Input Boundary necessary?

In Clean Architecture boundaries are interfaces, which I model in Python with abstract classes. The input boundary, which is between the controller and the interactor/use case does not need an ...
1
vote
1answer
110 views

Clean architecture and Repository pattern

I'm working in a new project and I'm trying to use the Clean Architecture approach with Repository pattern. I'm using .net core 3, C#, Automapper, MediatR and Dapper. I have these layers: Domain (in ...
1
vote
1answer
157 views

Domain Use Case

In my understanding of Uncle's Bob Clean Architecture, a Use Case (Interactor) is responsible for orchestrating the Entities. At the same time, it represents Application-specific rules. The business ...
1
vote
1answer
510 views

Use case interactions in clean architecture

I'm experimenting with Clean Architecture for my turn-based strategy game project. I have use cases that form hierarchies and need to be coordinated with each other. I would like some advice on how to ...
1
vote
2answers
203 views

Clean Architecture - How to pass request data towards inner, domain level Use Cases?

Use Case Interactor: We can see it in this picture how does a request cross the layers until it reaches the Use Case Interactor. How does the controller pass the request towards the Use Case ...
1
vote
2answers
143 views

Should a BDD feature be implemented by a one (and only one) clean architecture interactor?

TL; DR Given BDD documentation with features composed by several scenarios, should we: Create a single interactor per feature Create minor interactors per scenario, and composing the feature ...
1
vote
1answer
71 views

Clean Architecture: Layers for decoding messages and working with a map?

I work in the field of military aviation. The application is a WPF-App within a fighters aircraft and the machine, which runs the app is connected to the internal data bus of the aircraft and also to ...
1
vote
1answer
82 views

Is it good approach to create new viewModel class for every new Ui(Fragment/Activity)?

I am working on a project in which I am following clean Architecture from Google ... and for making code testable I am following an approach in which,I am creating a new ViewModel Class ViewModel ...
1
vote
1answer
613 views

Clean Architecture: Calling a Usecase from the Controller

In the context of Clean Architecture, is the following execution path right? The controller sends a request model (input) to an interactor. The interactor executes a use case dependent on the request ...
1
vote
1answer
80 views

Common Code for Transformation of an Entity

My api is exposing information centering around an entity Company. Companies are complex, and can contain Vendors directly, or can contain sub-companies which contain vendors themselves. A consumer ...
1
vote
0answers
47 views

How to avoid coupling of domain objects with UI data in a store-based Angular app?

The state of my TypeScript/Angular app contains objects from the UI layer and from the business domain layer. I'm exploring store-based solutions (eg ngrx, ngxs) to keep this state in memory. As ...
0
votes
2answers
119 views

How to deal with reusable use case?

I'm trying to implement the clean architecture and I'm not sure to quite understand when to reuse interactors (use cases). Considering that we have one use case such as get user information and we ...
0
votes
3answers
124 views

Techniques for Cleaning/Expiring Old Data

I have a database with data that "expires" in a way -- after 10 days, the status changes from "Completed" to "Archived" and after 30 days rows still marked as "Assigned" get unassigned, for various ...
0
votes
2answers
140 views

How to test business logic in isolation when it depends on input validation logic

Hello I am building a demo project to teach myself about clean architecture and unit testing. My setup is very similar to this github repo https://github.com/mmacneil/CleanAspNetCoreWebApi The ...
0
votes
5answers
179 views

Clean code for multiple entity representations

I'm wondering what is a clean solution for representing an entity in many different format. Let's suppose I have the following entity: Person { Long id; String title; String firstName; ...
0
votes
3answers
150 views

Can an entity include “technical” (not business related) information?

I want to to follow a clean architecture rules (with domain and architecture layers). I have a problem with properties that an entity should or should not have. Let's say that I have a User domain. ...
0
votes
1answer
142 views

Avoid too much dependencies for a Use Case in a Clean Architecture app

Context I'm currently developing an application following the Clean Architecture principles (at least I'm trying really hard to follow these). All my Dependency Injections are done manually, without ...
0
votes
0answers
60 views

Where to put use case calling threads in clean architecture?

I've just started using clean architecture, It's clean and nice, but I've found a bit confusing use case. My application should be able to register to update a token after some time, so I handled ...
-1
votes
1answer
74 views

Designing command and factory pattern with large conditions

I working on a project requiring quite a lot handlers to handle requests. In general, i'm comunicating with a communication card, receiving requests from any source (User Interface, Server it doesn't ...
-2
votes
1answer
56 views

Repeating CSS class contents. Structuring css code

I'm a backend developer working on a webpage, building the CSS part. I like to write as less code as possible and reuse them throughout the site, a lot of pages. I want to be able to reuse some CSS ...
-2
votes
1answer
74 views

Is a good practice to create Interfaces for use case objects?

Are use case classes (application services on DDD or a.k.a. Facades) stable? Should controllers and listeners be coupled with interfaces at all?
-2
votes
1answer
36 views

Where should Service Providers live?

I'm in a dilemma that might look silly. Where should Service Providers live? On a dedicated Providers folder: - Providers - CarProvider.foo - UserProvider.foo - Cars - Car.foo - Users - User....