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. ...
5
votes
2answers
172 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
967 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
411 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
2answers
584 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
152 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 ...
4
votes
2answers
712 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 ...
3
votes
3answers
334 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
1answer
294 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
0answers
134 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
4answers
597 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 ...
2
votes
2answers
139 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
2answers
412 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
1answer
1k 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
1answer
64 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). ...
1
vote
2answers
439 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
3answers
252 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 ...
1
vote
1answer
103 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
147 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 ...
1
vote
1answer
326 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
1k 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 ...
1
vote
1answer
69 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
384 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
78 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
206 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 ...
1
vote
0answers
92 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 ...
0
votes
2answers
104 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
120 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
121 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
3answers
140 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
107 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
1answer
73 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; ...
-1
votes
1answer
68 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
54 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 ...