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
0
votes
0answers
25 views

Should the Use Case be responsible for transforming its primitive parameters into typed data for the Entity to use?

I'm building a Use Case for creating blog posts, this Use Case has its own "DTO", which is basically a parameter object with only primitive data, as follows: Use Case's DTO (Parameter Object)...
2
votes
2answers
66 views

Should an Use Case method receive a “pre-filled” entity or a DTO as a parameter?

I'm building a use-case for creating blog posts, at first I thought of using an entity as a use-case parameter, and this entity would be created by the layer that calls Use Case, in my case a ...
1
vote
2answers
94 views

If Entities, in the Clean Architecture, are enterprise wide rules how different applications consume them?

In this post, Uncle Bob writes: Entities encapsulate Enterprise wide business rules. An entity can be an object with methods, or it can be a set of data structures and functions. It doesn’t matter so ...
0
votes
0answers
57 views

Passing Domain models from Presentation layer to data layer to make a networking request

So, I have this repository(Interface) in my domain layer public protocol ProfileRepository { func becomeVerifiedDriver(licenseImageName: String, vehicle: Vehicle)-> Single<Void> } and ...
-2
votes
0answers
34 views

Reference implementation for Clean Architecture?

I'm learning Clean Architecture. The examples online are mostly trivial - they describe how X can be achieved in theory, but never tend to actually do X in code. Is there any non-trivial reference ...
0
votes
1answer
50 views

Clean Architecture - Support plugins that can add new entities? [closed]

I'm following Uncle Bob's clean architecture for my application. However, I wish my application to be extensible via plugins. More specifically, I want the plugins to be able to add new entities and ...
0
votes
1answer
52 views

Catch “foreign” exception in adapter and convert them in own business exception is a good practice?

I am currently thinking about some design choices regarding exception handling. My current architecture looks a little like this: You can see that I have a UI where a try-catch middleware is cathing ...
3
votes
0answers
113 views

Best practice to reuse use cases in a clean architecture

Imagine a "clean architecture" in which you have two use cases. One of them is CreateCustomerHandler, and the other SignUpCustomerByGoogleAuthHandler. So, the ...
-1
votes
0answers
26 views

Avoid state on Presenter - MVP

I'm working on an Android app and I'm doing some refactor on a class that it was already there from months, and I faced that on the presenter they store the response of a service. private lateinit var ...
0
votes
0answers
31 views

Doing the same tasks from multiple places when using Clean Architecture and CQS?

I'm working on some tooling that will help speed up the process of setting up a new computer for new developers. I want the user to be able to execute many tasks either as one task or grouped together ...
3
votes
2answers
213 views

How to model classes that can be extendable?

I have recently inherited a codebase which has a weird problem and I am trying to search for an extensible solution that can solve my issue. Consider I have a model class that is used as a model to ...
2
votes
2answers
96 views

Checking the user in almost all use cases

I have a web application that has Users that belong to Companies. A User can only belong to 1 Company at a time and they can manage their own company information. I'm using java spring and I'm ...
0
votes
1answer
69 views

How do I implement a domain entity behaviour that depends on some external infrastructure?

I am in the process of developing some software using CQRS, ES and DDD. A part of the system is writing services for controlling devices and collecting data from them. Consider a "Start" ...
0
votes
0answers
39 views

Multiple endpoints but share the business layer

I am looking at a code base that has multiple APIs and traditional server rendered website. The business logic is duplicated between each of the APIs. I would like to clean this up and share the ...
0
votes
0answers
54 views

Job Scheduling in clean architecture

Imagine having the entity Counter and a use case that creates it. Moreover the business logic requires that every time a counter gets created a background task that increases the counter every 1s must ...
3
votes
2answers
161 views

Clean Architecture, how does the use case interactor generate different outputs?

I'm trying to understand how do controller and presenters work in clean architecture projects and could use some help. Specifically about generating multiple outputs from the use case. In the Clean ...
1
vote
2answers
178 views

What naming convention should I use in Clean Architecture?

in the code base of my job, we use clean architecture standards. So we have controllers, use cases, etc. To name them, we follow this template: {name}{type}, where type is one of the following values: ...
0
votes
3answers
106 views

Chain of responsibility look alike but choose handler at runtime

currently I have an structure of PopUps and I've been thinking to use Chain of Responsibility pattern, but the difference is a popup can back to previous one PopUp and also can go to any other PopUp. ...
1
vote
1answer
109 views

Clean Architecture: Controller creates a RequestModel instance or implements RequestModel?

I have checked many articles and discussions around the web. So we have the main diagram: So we have Controller pointing directly to RequestModel. So straight to the point, should I: Create a ...
0
votes
0answers
45 views

In what layer should API be called in Clean Architecture - in Repository or in Use Case?

I am trying to implement Clean Architecture on my Android App with standard MVVM components. Almost every example I have found deals with simple business logic, i.e. simple CRUD operations over data ...
3
votes
1answer
329 views

Clean Architecture - Controllers and Presenters

I am having a hard time trying to wrap my head around the relationship between Controllers and Presenters in Uncle Bob's Clean Architecture. In most of his videos, he talks too little about ...
1
vote
1answer
114 views

In which layer should I load views on a Clean(ish) architecture?

I am trying to organize my architecture following the clean architecture while using some common practices/frameworks. I'm writing in PHP, but have no problem with other languages. The flow of my app ...
1
vote
1answer
73 views

Proxy / Decorator Design pattern scalability to a lot of methods

I'm trying to solve a common problem of logging each method that calls 3rd party operation and I don't understand how to scale it up. Current implementation: public class ElasticsearchClient { ...
0
votes
4answers
90 views

Is web application routing Enterprise or Application Business Rules from the viewpoint of Clean Architecture?

From the one side, customer can order "I need products list on /products and conversion statistics on /statistics/conversion". In this case, we need to obey in and write something like: ...
4
votes
1answer
146 views

How does Robert Martin's “Clean Architecture” deal with Progressive Web Apps (PWAs)?

According to Robert C. Martin's "Clean Architecture" you should try to structure your system in such a way as to separate low-level concerns from high-level domain concepts. Following this ...
7
votes
3answers
550 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
147 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,...
3
votes
2answers
260 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
95 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
203 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
591 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
118 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 ...
3
votes
2answers
1k 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
0answers
39 views

Should we leak concurrency in the application layer, domain, controller,

Consider a (simplified) version of a/our (clean-)architecture in the image below. Using Cosmos, we want to use optimistic concurrency to ensure we do not suffer from any lost updates. This can be ...
0
votes
1answer
84 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 ...
0
votes
0answers
69 views

What 'onion' layer should ASP.NET Core WebApi controllers reside in?

I have controllers and they are in my API layer. They don't use types from the Infrastructure layer and (in Cockburns description of Onion Architecture) do act as the entry point to the domain. I've ...
-1
votes
1answer
138 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
0answers
33 views

Abstracting multiple data sources with one interface for the repository to use

I'm trying to apply the clean architecture, and among other things, I have a datasource layer and a repository layer. The repository uses an interface to interact with the underlying data sources (...
0
votes
1answer
159 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 ...
1
vote
2answers
390 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
490 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
470 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 ...
-1
votes
1answer
519 views

What is enterprise logic, business logic in clean archittecture?

I had go through jason taylor 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
522 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
70 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
158 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
1answer
217 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 ...
0
votes
1answer
163 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
63 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 ...