Questions tagged [clean-architecture]
Clean Architecture is a book by Robert C. Martin that contains solutions to architecting software solutions. Collectively these concepts are referred to as "Clean Architecture".
256 questions
2
votes
2
answers
247
views
How should I implement data access with jpa to meet Clean Architecture/DDD
For the last few days I'm searching any information about compatibility of JPA and Clean Architecture/DDD. I found next ideas for decoupling application from hibernate.
Do not use @ManyToMany or @...
4
votes
4
answers
168
views
Clean Architecture - Chapter 23: Presenters and Views
Everyone!
While reading Chapter 23 of the book Clean Architecture, specifically the Presenters and Views section, I came across something rather unexpected where Uncle Bob states:
Every button on the ...
2
votes
2
answers
231
views
Clean Architecture Chapter 8 - Financial Data Mapper
I’m studying Clean Architecture, and I came across a technical concept in the diagram from chapter 8. In this chapter, the author states that the Financial Data Mapper implements the Financial Data ...
0
votes
0
answers
57
views
Where should validation be placed? [duplicate]
Recently I asked the following question regarding Clean Architecture with some things that were unclear to me: Clean Architecture using interfaces or Mediator approach?
I think I have a better ...
3
votes
1
answer
153
views
Clean Architecture using interfaces or Mediator approach?
I'm starting a new project and I want to follow a Clean Architecture(ish) approach.
I've modeled my projects in that manner (attached diagram).
For the API I'm using FastEndpoint since I like it, it'...
0
votes
1
answer
246
views
Should I create interfaces for each entity, or should I use plain classes?
I’m currently creating a class diagram to develop an application following the “Clean Architecture” guidelines by Robert C. Martin. I’m unsure about how to structure the “Entity” component, ...
2
votes
1
answer
121
views
Should our api-response-to-domain-entity transform functions be in the API/Infrastructure layer, or the Domain layer?
Should our api-response-to-domain-entity transform functions be in the API/Infrastructure layer, or the Domain layer?
We have a react-native mobile application written in TypeScript.
We have separated ...
2
votes
2
answers
292
views
Advanced Scenarios in Clean Architecture
We have a very complex and mature ASP.NET web application that is about 20 years old and has 5 million lines of code spread across roughly 30 project in a single monolithic solution.
It's running on ....
0
votes
2
answers
160
views
How to handle data-intensive functionality of domain objects in Clean Architecture?
I'm going to ask this question using a concrete example. An optimal answer would take into account that this is just an example for the general problem.
I'd like to implement a user management system ...
0
votes
1
answer
98
views
SQLAlchemy (ORM) details in service layer in Clean Architecture?
I'm trying to decide how to hide data layer details (joinedload of sqlalchemy) in clean architecture.
I have some dilemma about clean architecture. Please look at the code of some api endpoint (full ...
-1
votes
3
answers
465
views
Moving from 3-tier architecture to clean architecture
Generally, for a simple project: how do you move from 3-tier architecture to clean architecture? What I'm trying to do here is to get a feedback on how would the developer which understands 3-tier ...
1
vote
3
answers
186
views
Where to handle Validation Errors in Business logic layer?
I'm currently designing a multi-layered application and am trying to figure out the best practice for error handling within the Business Logic Layer (BLL).
Should I handle errors directly within the ...
0
votes
1
answer
190
views
Separation of concerns between business layer, data layer and presentation layer without losing information
I'm developing an api in Fast API using sqlalchemy to manage my ORM classes and operations with the database.
I'm dealing with some design decisions to have my classes as little coupled as possible ...
0
votes
1
answer
187
views
Clean Architecture: Why are the request (input)/response(output) data structures not consider dependencies of the interface?
In Uncle Bob's Clean Architecture, he provides the following diagram:
This diagram is used for discussing the Open-Closed Principle (OCP). I understand that the interface Financial Report (FR) ...
0
votes
0
answers
84
views
Is it really difficult to test these “Service” methods in this Rust Clean Architecture proposal? Is there some other catch I'm not considering?
I reproduced a small example of kerkour's Rust Clean Architecture on the Rust Playground.
The code is just an example and the methods code makes no sense at all.
This architecture leaks DB information ...
1
vote
1
answer
120
views
Need help on Clean Architecture with Service/Manager/Controller
I am developing an Android application trying to comply with Uncle Bob's clean architecture.
User interface has a text and a button. Button triggers a usecase (TextToSpeechUseCase) from viewmodel.
...
0
votes
1
answer
289
views
Is IRepository allowed to know about database entities?
I am trying to apply Robert Martin's Clean Architecture on my .NET project. In one of chapters about boundary, it talks about that database interface should reside in business logic component rather ...
3
votes
2
answers
391
views
What value does the mediator pattern add beyond dependency injection?
Does the mediator pattern add any value beyond dependency injection? I am encountering the mediator pattern for the first time in context of this sample application, which is meant to demonstrate how ...
0
votes
0
answers
86
views
How handle foreign keys in bounded contexts inside a monolith?
in my company we have a Django monolithic application. To be clear, we are not looking into moving to micro-services. For the past few months, I have reading and implementing a DDD architecture inside ...
1
vote
2
answers
219
views
CQRS: Multiple entry points for a single command
I’m trying to follow the Clean Architecture and CQRS within an application that, let’s say, create a product.
To achieve this, the application has 3 adapters, one for reading a file, another for ...
0
votes
0
answers
139
views
DDD - Managing Relationships between Domain Aggregates
To understand DDD better, I am trying to create the Domain Layer of an online class application. I have a concept of a Student, Tutor and Session.
I thought of having one aggregate called Session and ...
5
votes
4
answers
832
views
Clean architecture and components
I'm reading the book "Clean Architecture" from Robert C. Martin and there is something that has been puzzling me in most parts of the book.
When the author introduces the term "...
0
votes
1
answer
170
views
Where to put the reference to Application Insights in an application designed with the Clean Architecture template?
We are implementing an application by trying to follow the Clean Architecture template for C#.
Our application is an ASP.NET core web api and we want to implement the observability for that ...
1
vote
1
answer
332
views
Onion Architecture: Where to put Hangfire specific logic
We have a .net core app with the following folder / onion structure:
WidgetApp -> Core -> Application -> JobAutoStarter -> JobAutoStarter.cs
WidgetApp -> Core -> Domain -> ...
1
vote
1
answer
111
views
Clean architecture in webapp : how to compose a page which needs to call many use cases?
I'm writing a pretty common Symfony web application, in which HTML is server side rendered (it's not an SPA application).
To illustrate my question, let's take a pretty common fictional eshop ...
-3
votes
1
answer
220
views
How should I architect a cricket scoring app?
Cricket scoring is complex and I want to build an app in part to practice good design principles/patterns and develop a clean solution.
A few high level classes I have in mind are:
Match | Innings | ...
3
votes
4
answers
981
views
Is validation part of presentation layer or business logic? [duplicate]
We're working on a new project (backend, API), following the "clean code" and "clean architecture" principles (described in Robert Martin's books), dividing our application into ...
1
vote
2
answers
158
views
Entities can move from one Clean Architecture use case to another using the controller?
I'm working on a project with the task of creating a route to checkout ticket purchases for events. In this scenario, I have a controller that receives the request with order data, client information, ...
0
votes
1
answer
327
views
How choose between Clean Arch and Hexagonal Arch(Ports And Adapters)?
I'm studying architecture patterns and I don't understand which type of scenario is more preferable to use clean architecture or hexagonal architecture. Is there something like that? For example, &...
4
votes
2
answers
2k
views
Where to define the interfaces of the infrastructure in a clean architecture and DDD?
I have been reading about clean architecture and following Domain-Driven Design. In all the examples I have found, the interfaces of the repository are defined in the domain.
However, it is in the ...
0
votes
2
answers
454
views
Should entities always be simple and mapped?
I am told everywhere that entities are only to represent the data structure, then entities should be mapped to a model and then the model possibly to a DTO.
The other way is similar, DTO -> model -&...
-1
votes
2
answers
711
views
Best Practice for Integrating Domain Services with Infrastructure Layer in Clean Architecture [closed]
I'm currently implementing clean architecture in my project.
My application includes various types of communication protocols (TCP, HTTPS, etc.) implemented in the infrastructure layer.
These ...
1
vote
2
answers
343
views
Clean Arch: Where to put HTTP request inputs handling logic (dto) before calling the service layer
I'm refactoring a common web app (not spa but traditional server side html rendering).
The design/code organization follows more or the less the Clean architecture concepts (ie:
controller calls a use ...
3
votes
2
answers
570
views
Components in Clean Architecture
I'm a novice in architecture. Now I’m reading Clean Architecture and I don’t understand one thing. I'm wondering at what stage should I create components? Before any design or when I already have some ...
1
vote
3
answers
431
views
Is low code quality and lack of testing the norm in B2B software development?
I've been working at this company for about a year now. it's a growth company working in B2B. I'm one year out of university, with a major in computer science. I work in the web team, using an Angular ...
0
votes
1
answer
103
views
How to balance "Draft capabilities" in Clean Architecture: handling Partial Models and Database Integration
I have an app with "clean architecture" classic layers:
Ports (such as HTTP, GRPC, GRAPHQL resolvers)
Services (CRUD methods and others)
Adapters
Domain
My app has of course multiple &...
2
votes
3
answers
727
views
Streams and clean architecture
I am pretty new to async programming and the whole stream stuff, since i have a web programming background with php, where async programming and streams isn't really a big topic most time.
I try to ...
0
votes
1
answer
140
views
Validation logic dependencies and separation of concerns
I am going back and forth on an aspect of our FluentValidation and MediatR pipeline behavior implementation. We receive requests which, in a Mediator pattern, are mapped to command or query objects, ...
-2
votes
1
answer
107
views
Clean code: formatting rules, dependent functions, multiple calls [closed]
About formatting
Here are two scenarios in which the details of the formatting are described.
How should in the clean code way, this be formatted
Scenario 1: Dependent functions of dependent functions
...
13
votes
4
answers
5k
views
Is there a clean way to model methods that only make sense depending on the current state of the object?
Let's say that I have a class called Mission. This class is intended to represent a mission requested by a professor working in a faculty. Mission has a private enum field representing whether the ...
0
votes
2
answers
434
views
Clean Architecture with Microservices
I'm fairly new at system architecting and I'm looking for some advice. My company is revamping its order management system. Currently is a monolith system that scales very poorly and is difficult for ...
1
vote
1
answer
553
views
Designing Clean Architecture(Hexagonal) for a Spring Boot Application : Project Layout and Class Organization
I'm currently in the process of integrating Clean Architecture into my Spring Boot project and I'm seeking advice on the ideal project structure and the types of classes and projects that should be ...
1
vote
1
answer
121
views
UI or Application layer responsibility - retrieving additional data for display
I have an application service that retrieves Order data. The service is consumed in UI, where it can be edited by users.
Additionally, the users wants to see related data such as ordered products' ...
1
vote
1
answer
425
views
Clean architecture for file upload in a flutter app
I have started a flutter app and want to apply clean architecture to it. The first use case i have is the following:
A user provides file(s)via "open file" dialogue. The provided files ...
6
votes
2
answers
6k
views
Key difference between Hexagonal Architecture vs Clean Architecture?
I am trying to improve the architecture for my React app project that has grown in size lately.
I'm looking at Hexagonal architecture and Clean architecture, and I couldn't really see the difference ...
2
votes
2
answers
772
views
Clean Architecture: Loading data for the domain layer
Let's say my domain has a User Entity that has a many to many relationship with itself representing "Friends"
public class User
{
public int Id;
public IEnumerable<User>? ...
0
votes
3
answers
285
views
Can the application layer extend the domain models?
I write BFF (Backend For Frontend) and it's domain is to provide user info and microservices integration.
The User domain model looks like below:
public class User
{
public required Guid Id { get; ...
0
votes
2
answers
257
views
Domain Project and Identity Project circular dependency
I am currently working on implementing the Clean Architecture pattern using Entity Framework. However, I've encountered an issue related to the design of my Domain project. In this project, I need to ...
2
votes
1
answer
2k
views
Clean architecture - how to manage use cases that depends on external apis
How to apply clean architecture concepts in a software that depends on External APIs.
Example:
A business that offers some kind of subscription to its users.
Its convinient to store some subscription ...
0
votes
1
answer
81
views
Communicating unpredicted Failure from Repository implementation to Applicaiton Layer
My application follows Clean Architecture wherein the Application Layer wraps the Domain Layer. I try to adhere to DDD more-so as a "guiding light" than a strict rulebook.
Within the Domain ...