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
1 vote
1 answer
400 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
1 answer
3k 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. ...
user avatar
1 vote
1 answer
89 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
0 answers
325 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/...
  • 29
4 votes
1 answer
2k 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 ...
  • 263
0 votes
2 answers
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 ...
  • 668
1 vote
2 answers
683 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
2 answers
78 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 ...
  • 23
1 vote
0 answers
66 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 ...
  • 111
1 vote
0 answers
275 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
2 answers
905 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. ...
4 votes
0 answers
693 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, ...
  • 181
-3 votes
1 answer
52 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
1 answer
197 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 ...
  • 221
-4 votes
1 answer
141 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 ...
  • 101
14 votes
1 answer
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
2 answers
272 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, ...
  • 119
4 votes
1 answer
6k 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
2 answers
205 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 (...
  • 117
2 votes
5 answers
289 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
3 answers
264 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 ...
  • 164
-1 votes
1 answer
375 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 -> ...
  • 128
-3 votes
1 answer
244 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
1 answer
836 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 ...
2 votes
0 answers
202 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" ?> <...
17 votes
4 answers
18k 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
1 answer
171 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 ...
  • 101
1 vote
1 answer
248 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 ...
6 votes
3 answers
365 views

Where to convert primitive types in meaningful types in Clean Architecture / Onion Architecture

The book "Implementing Domain Driven Design" (page 361) suggests to use special types to distinguish several kinds of IDs, e. g. using BookId(1) instead of just 1 of type Int or Long. In my Clean ...
  • 816
8 votes
1 answer
3k views

How & Should we use Clean Architecture in Front-end?

Just a little explanation: "I'm used to be a solo front-end developer in my company and using default folder-structure and way of coding which vue-cli provided, it is good for a solo developer and ...
3 votes
2 answers
1k views

Uncle Bob's Clean Architecture - Dealing with anemic interactors, tiering, and front-end MVVM

Background In Uncle Bob's Clean Architecture, use case interactors are responsible for the orchestration of business objects to accomplish some user goal. As an easy example, an e-commerce application ...
2 votes
1 answer
5k views

Clean architecture and Repository pattern

I'm working in a new project and I'm trying to use the Clean Architecture approach with Repository pattern. I'm using .net core 3, C#, Automapper, MediatR and Dapper. I have these layers: Domain (in ...
7 votes
3 answers
2k views

Clean Architecture: Use case spanning multiple UI elements

So I'm currently trying to write a project using Clean Architecture. Its a Unity Engine project which doesn't make the task any easier. The Issue I'm running into however is much more basic and has ...
0 votes
1 answer
612 views

Is a good practice to create Interfaces for use case objects?

Are use case classes (application services on DDD or a.k.a. Facades) stable? Should controllers and listeners be coupled with interfaces at all?
-2 votes
1 answer
42 views

Where should Service Providers live?

I'm in a dilemma that might look silly. Where should Service Providers live? On a dedicated Providers folder: - Providers - CarProvider.foo - UserProvider.foo - Cars - Car.foo - Users - User....
2 votes
2 answers
89 views

Mantain same entity data in different layers

I'm trying to split the use of a business entity (e.g. a post) thought an application uses, trying to obtain a clean architecture So I will likely have: A class model, where the business logic lives ...
1 vote
2 answers
298 views

Should a BDD feature be implemented by a one (and only one) clean architecture interactor?

TL; DR Given BDD documentation with features composed by several scenarios, should we: Create a single interactor per feature Create minor interactors per scenario, and composing the feature ...
5 votes
2 answers
2k views

Clean Architecture - How to pass request data towards inner, domain level Use Cases?

Use Case Interactor: We can see it in this picture how does a request cross the layers until it reaches the Use Case Interactor. How does the controller pass the request towards the Use Case ...
  • 65
1 vote
1 answer
225 views

Clean Architecture: Layers for decoding messages and working with a map?

I work in the field of military aviation. The application is a WPF-App within a fighters aircraft and the machine, which runs the app is connected to the internal data bus of the aircraft and also to ...
  • 33
3 votes
2 answers
1k views

Clean Architecture and Persistence Annotations

If one wants to comply with the clean architecture principle 100%, they must not annotate the entities in the entities layer with database-specific annotations (like Hibernate, Neo4j, etc.). So, two ...
  • 199
5 votes
3 answers
2k views

Should an interface be defined in the infrastructure layer if it's only used by an implementing class in that layer?

Overview If an application is being developed following a clean architecture / DDD approach, my understanding is that the application core or domain layer should contain classes and interfaces that ...
  • 439
0 votes
0 answers
127 views

Where to put use case calling threads in clean architecture?

I've just started using clean architecture, It's clean and nice, but I've found a bit confusing use case. My application should be able to register to update a token after some time, so I handled ...
1 vote
0 answers
191 views

How to avoid coupling of domain objects with UI data in a store-based Angular app?

The state of my TypeScript/Angular app contains objects from the UI layer and from the business domain layer. I'm exploring store-based solutions (eg ngrx, ngxs) to keep this state in memory. As ...
3 votes
0 answers
142 views

data transfer objects between abstraction layers

I want to create an Express REST API and want to try following the clean architecture ideas. I was reading about it but didn't get the idea of the communication between the abstraction layers. Let's ...
-3 votes
3 answers
783 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 ...
  • 189
6 votes
2 answers
577 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 ...
  • 169
2 votes
1 answer
187 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 ...
0 votes
3 answers
171 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 ...
  • 117
2 votes
2 answers
701 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 ...
6 votes
1 answer
503 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). ...
  • 161