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".
246
questions
0
votes
1
answer
65
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
128
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) ...
-3
votes
0
answers
67
views
How to use ElysiaJS in a Clean Architecture approach
I'm working on a server application and trying to make it as clean as possible, considering the patterns and principles of Clean Architecture. However, I'm not sure how to proceed with the controllers....
0
votes
0
answers
73
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
108
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
270
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
272
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
77
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
206
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
130
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
765
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
136
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
273
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
106
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
185
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 | ...
1
vote
4
answers
673
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
144
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
264
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, &...
2
votes
2
answers
1k
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
351
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
592
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
302
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
493
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
426
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
95
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
610
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
123
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
90
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
0
answers
86
views
Should input adapters receive the domain model?
This article on Medium addresses the scopes of the domain model in hexagonal architecture.
I have sketched the following generic hexagonal architecture:
On the one hand, the secondary/output adapter ...
0
votes
2
answers
396
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
527
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
108
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
382
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
4k
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 ...
1
vote
2
answers
684
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
259
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
235
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
1k
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
79
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 ...
9
votes
4
answers
3k
views
Is it okay to have misleading struct and function names for the sake of encapsulation?
I'm writing this library in which the user can provide custom code defining the algorithm used for finding an optimal solution. In the papers that I have read, the targeted user thinks in terms of ...
3
votes
3
answers
2k
views
Clean Architecture and Access Control
I'm working on a .Net core API for product configuration and ordering. The ticket for Permissions has come up and I've been tasked with developing a solution, ideas of middleware have been mentioned.
...
-1
votes
1
answer
211
views
Split or join two use cases that are similar in Clean Architecture
In my working project I have a CustomerRegisterUseCase, that has following steps:
validate email is already in use;
hash password;
save customer in temporary table(tranfered to customer table after ...
1
vote
1
answer
181
views
deciding where to put "formatting" logic - database or in application layer
We have an application that fetches user data from an Azure tenant via MS Graph. We need to distinguish between guests and regular members.
Guests come back with Usernames that look like this:
...
2
votes
2
answers
2k
views
Where to place a common database connection in clean architecture?
I am currently trying to follow the clean architecture approach but i wonder where common things like a database connections should take place.
Since i think a database connection usually will be ...
0
votes
0
answers
96
views
Access one usecase into another usecase
I am working on machine learning project. I use jupyter for quick prototying. Now I am trying to convert it into concrete python project using clean architecture.
entities/
- problem.py # ...
2
votes
1
answer
2k
views
Clean Architecture Use Case and db transactions/unit of work
I've started working on a LoB application (as a learning exercise) while trying to express business logic with use cases from Clean Architecture. First use case is customer onboarding where client can ...
2
votes
1
answer
2k
views
Build a Rust project using Clean architecture and DB transactions in the same DDD bounded context
This is just an example of an (still incomplete) real-world project written in Rust using a clean architecture: https://github.com/frederikhors/rust-clean-architecture-with-db-transactions.
Goals
My ...
0
votes
1
answer
267
views
Decoupling modules of a monolith
As part of an migration from .NET Framework to .NET Core we're looking to decouple elements of our monolith into more manageable modules. Ideally following a clean architecture/DDD/microservice ...
0
votes
1
answer
457
views
Separating Application (Business Logic) Layer to Multiple Module Layers in Clean Architecture
Currently, I'm designing the Project based on Clean Architecture composing with 4 layers:
Domain
Application
Infrastructure
Presentation
Since the project is pretty huge, I'm now considering to ...