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".

Filter by
Sorted by
Tagged with
8
votes
3answers
1k views

What should presenters return in Clean Architecture?

In Clean Architecture, a use-case calls a presenter, based on the agreed output object. When the presenter is called, it returns a ViewModel used by the view. That is fine until you have more than two ...
1
vote
1answer
235 views

How to make the controller framework independent in Clean Architecture?

Recently, I've been studying Clean Architecture and I have some doubts. I want to make a REST API that adheres to this architecture. To do that, I define my entities, use-cases, etc. For each endpoint,...
4
votes
2answers
405 views

Hexagonal/Clean Architecture - threads, locks, synchronization

All the examples across the internet try to pretend that every application is run on a single thread. There is no problem with synchronization, multithreading etc. Uncle Bob, in his "Clean ...
0
votes
2answers
111 views

Improving dependency inversion principle

Reading a little bit about Functional core & imperative shell pattern, I am wondering if the DI principle can be improved. What happen if instead of having an Infrastructure layer depending on ...
-1
votes
2answers
388 views

Clean Architecture - Reuse exception handling code for a specific use case or repository function

I am implementing the clean architecture. The use case should not know details about the UI because the UI is in a more outer layer. Same goes for the data layer. For the data, the use case should ...
2
votes
1answer
1k views

Moving shared CQRS/Mediatr Request Handler logic into services and avoiding code/logic duplicity?

We recently embraced Clean Architecture and CQRS, by way of Mediatr, in several of our new applications. A similar (SPA-based) demo can be seen here. For many of our WebApi-based projects, this worked ...
0
votes
2answers
154 views

Should default settings be considered as business rules from the viewpoint of "Clean Architecture"?

The examples of default settings: Default port for server applications Default resources directory for Java Applications Default Webpack config file ("webpack.config.js") My particular ...
5
votes
3answers
3k views

Clean Architecture Gateway layer depends on outer layer

Looking at the clean architecture layers and flow diagrams, and implemented it my self in my applications, I've always wondered which layer is supposed to contain the DB, or any 3rd Party service or ...
0
votes
1answer
95 views

Correct Architecture for Monolith with Go

I'm designing a monolith RESTful API that potentially sometime in the future may turn into microservices. I'm also trying following Uncle Bob's clean code as well. My question lies in structuring the ...
-1
votes
1answer
171 views

Understanding Clean Architecture

Below is my understanding of the projects involved .However my confusion comes from the difference between Application/Core/Domain . Is it also correct to say Core = Application + Domain because i ...
0
votes
1answer
292 views

How do proto models in gRPC fit into Clean Architecture

I know they say that clean architecture are guidelines, and individual projects will affect implementation, but is there a general thought on the correct implementation? A lot of times I see DTO ...
2
votes
3answers
748 views

What is a good naming convention for Interface Adapters, Use Cases / Interactors, Entities?

I'm using MVVM + Clean Architecture in my app. And I sometimes don't have any idea if my namings are good enough for each Interface Adapters, Use Cases / Interactors, Entities. For View Models, it's ...
-1
votes
1answer
46 views

Clean approach for designing data related dependencies between different systems

I have the following situation in my current project: There is a system A which exports data, that will be consumed by system B. System A is something like a webshop which exports data like orders to ...
3
votes
1answer
699 views

How to handle complex business logic permissions in the database?

I have a system in development and part of the system is how permissions are handled, business logic rules for this are very complex so after lots of trials, we couldn't fit them directly in the ...
1
vote
3answers
634 views

Do adapters get only called by usecases?

Suppose we have a layered architecture like onion architecture or clean architecture with three modules representing each layer: domain.py usecase.py databaseadapter.py The domain layer contains the ...
0
votes
2answers
1k views

What is enterprise logic, business logic in clean architecture?

I had go through Jason Taylor's link. He mentioned that The Domain layer contains enterprise logic and types and the Application layer contains business logic and types. The difference is that ...
3
votes
1answer
762 views

Business logic on the client side of a modern web app

If we look at the typical software architecture guide, it will have the domain layer, application services, and UI, where domain layer contains the business logic. This is a nice clean separation ...
1
vote
0answers
108 views

Socket.io behind api gateway

So the architecture I am currently working with, we have an api-gateway that gets all the requests and publishes them to our Eventsystem/ or directly to our essential services(auth, etc). Now we want ...
3
votes
1answer
173 views

Why dependency direction is determined by levels and not by change frequency?

Clean Architecture defines level as a distance from inputs and outputs. So Entities or business-objects are the highest level. What is a practical reason to make lower level dependent on higher level? ...
1
vote
2answers
368 views

Clean Code: How much architecture code should be written if architecture is supposed to be fluid

I watched a video series from Uncle Bob on Clean Code. He makes a few points on architecture which I both agree with but I believe could have clarification. From Uncle Bob: The Interactor is ...
1
vote
1answer
311 views

Moving authentication outside the domain layer

In discussion about an architecture decision that we do consider wrong and how exactly to address it, some lack of understanding on the matter arose. In dealing with authentication and authorization, ...
0
votes
1answer
80 views

Mutli tenant app with onion architecture and multiple presentations

Currently I started designing a new multi tenant SaaS application based on the onion architecture in C# Using a rest web API to expose my services and consume them on 3 platforms. Two web apps (one ...
1
vote
1answer
303 views

Clean Architecture: Can Use Cases Imply UI?

In the chapter "Business Rules" of his book "Clean Architecture", Robert C. Martin comments on the relationship between use cases and the UI: [...] the use case does not describe ...
4
votes
1answer
2k views

Clean Architecture use case testing

Use case interactors in the Clean Architecture consists of the application specific business rules. Interactors uses the Data Access Interface to fetch the required data from the data access layer. ...
1
vote
1answer
85 views

How to decide on abstraction level and entity definitions?

I am working on a hobby project of mine where I want to make an application to doing my personal finances. Just for learning. I am trying to adhere and implement best practices and patterns to learn ...
2
votes
0answers
261 views

Layers of validation for clean architecture in .Net Core web application

For a clean architecture where there is presentation layer (Javascript), web api layer, application/domain layer, infrastructure layer (EF Core ORM). Let's say it is an ATM system and the use case/...
4
votes
1answer
1k views

DDD and MediatR - where the Validation and Business Logic go

I'm trying to get to grips with Domain Driven Design and MediatR. A reaction to being involved with applications that favour Services for almost everything. I see so much value in DDD and I'm trying ...
0
votes
2answers
2k views

How to handle different types of errors in Clean Architecture?

So, in the process of creating a user there are 4 possible outcomes: Username is already taken Email is already taken Username is invalid Email is invalid Here is what I have in the controller for ...
1
vote
2answers
449 views

How to organize database access logic for the infrastructure and application layer when avoiding ORM tools?

I'm trying create a .NET Core project and followed some guides to create a basic architecture Jason Taylor - Clean Architecture with ASP.NET Core 3.0 Sample project Clean Architecture Template I'm ...
0
votes
2answers
75 views

How to implement an app with an actions toolbar?

Say I am creating an app which contains selectable components and a toolbar/action bar. Some tools work on selected components only, some work on all components together. Pretty standard stuff. I can ...
1
vote
0answers
42 views

Does my ASP.NET architecture implement DDD in a safe and future proof way?

I'm very new to DDD and sometimes confused by it because many people inside the DDD community tend to have very different approaches when it comes to implementation. I tried to summarize all what I've ...
1
vote
0answers
210 views

Clean architecture and state pattern

I am working in an GUI application that would work as follows: It will retrieve and save data from any of the following sources: A "Cloud Library": This library would get and save data to a cloud. ...
8
votes
2answers
653 views

Why can't Entities leave the inner layers in the Clean Architecture?

I was reading about the clean architecture, and I don't get this part: Don't use your Entity objects as data structures to pass around in the outer layers. Make separate data model objects for that. ...
2
votes
0answers
484 views

Identity and access management in Clean Architecture and MVC design

The application user has a lot of standard functionality we see in most applications. At a high-level, this includes some form of authentication, authorization, and session management. At a low-level, ...
-3
votes
1answer
51 views

In which layer should a `MailerInterface` be?

Speaking about DDD, in which layer should a hypothetical MailerInterface be? I know the implementation (or adapters) for each specific mail sender package should be in the infrastructure, but these ...
0
votes
1answer
145 views

Notify user in a event driven architecture

We have put in place an account service management : its reponsability is to let a user register is account, confirm his email, etc... We have put also in place a process layer that is reponsible to ...
-4
votes
1answer
64 views

How to decide what should be bounded context

I am trying to develop a demo application and confused while designing context. Let's say we have three entity and their properties User Id Email Todo Questions Answers Value ...
14
votes
1answer
6k views

Clean Architecture: Should each view have its own presenter and viewmodel?

I am still thinking about clean architecture and just ran into a question regarding the higher levels (Views and Presenters) I am posting Uncle Bobs picture first here that you remember what I am ...
3
votes
2answers
252 views

Architecture for real time updates from the data in file system

I am trying to revamp my legacy application to make it scalable and performant. Its current architecture is something like this Consider a short-lived script that gets invocated 500k+ times a day, ...
3
votes
1answer
5k views

Implementing clean architecture

I just read the book 'clean architecture' by Uncle Bob and really like the approach. But the big disappointment came when I tried to implement it in C#. I really hope you can help me with some ...
0
votes
2answers
178 views

Collect Data of different Modules inside a Monolith

During my first attempt of implementing a project with the "Clean Architecture" I try to implementation a job portal where I came across a problem concerning the communication between (...
1
vote
5answers
251 views

Microservice should be an independent software unit - Up to which level?

I have read several times that a Microservice should be an independent software unit. But what does that mean exactly and is it really achievable for each business case? Does that mean that I can run ...
1
vote
3answers
210 views

How to design a stable API for a progress display function?

Task Description I need a way to wrap different types of progress bars in a way that an algorithm can update the progress without knowing about the exact implementation. The progress implementation ...
-1
votes
1answer
287 views

Clean Architecture: are repositories always needed?

I'm trying to apply Clean Architecture to a mobile Android App, but I still have some doubts about how to manage API calls. Currently, the classes are structured like this: View -> ViewModel -> ...
-3
votes
1answer
229 views

What is the simplest version of best practice application architecture for a backend in C# and ASP.NET Core WebAPI?

I know that in some contexts, best practice would be DDD, CQRS and EventSourcing, but in my case this would be too complicated of two reasons: My team is beginners, and we want them to be productive ...
-1
votes
1answer
781 views

Android project, clean architecture and modular approach

I have this project with MVVM and clean architecture well implemented but I've decided to split it into modules. Right now I have: apimodule apimodule: with the retrofit dependencies app: with the ...
1
vote
0answers
128 views

Changing entities in Clean Architecture

I'm modeling the "Domain" Layer of "Clean Architecture" for an application that gets its data from an XML file when starts. The XML file looks like: <?xml version="1.0" encoding="UTF-8" ?> <...
14
votes
4answers
12k views

Difference between Domain Driven Design and Clean Architecture

I have been studying Clean Architecture (CA) by Robert C. Martin and have found it quite useful in promoting architectural standards for large applications. Through implementation of a case study, I ...
0
votes
1answer
141 views

How do I deal with multiple repositories for one aggregate?

Suppose I have in my domain model two aggregates: Dog and Cat. Dog is composed of DogName and DogFood. Cat is composed of CatName and CatFood. The repositories, however, are a PetNames API which ...
1
vote
1answer
188 views

Define input and output interfaces for each application layer

I want to create a multi-layered backend architecture with a REST layer and GraphQL layer later on. So let's say you would start with the basic layers controller, service, repository would it make ...