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".
Questions tagged [clean-architecture]
262 questions
132
votes
7 answers
Clean Architecture: Use case containing the presenter or returning data?
The Clean Architecture suggests to let a use case interactor call the actual implementation of the presenter (which is injected, following the DIP) to handle the response/display. However, I see people implementing this architecture, returning the…
swahnee
- 1,455
55
votes
5 answers
Is "Clean Architecture" by Bob Martin a rule of thumb for all architectures or is it just one of the options?
I really liked the concepts in the video The Principles of Clean Architecture by Uncle Bob Martin. But I feel like this pattern is like a combination of Abstract Factory and Builder patterns at its core.
This is one way to write good programs but…
Vedant Agarwala
- 835
- 1
- 9
- 16
49
votes
3 answers
Using a "Pass-through (God) Service" is bad, right?
My team has developed a new service layer in our application. They created a bunch of services that implement their interfaces (E.g., ICustomerService, IUserService, etc). That's pretty good so far.
Here is where things get a bit strange: We have a…
Vin Shahrdar
- 495
- 4
- 6
36
votes
5 answers
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 have a bit of experience of how it can help build…
Matthew Knill
- 483
36
votes
4 answers
Clean Architecture - Too many Use Case Classes
I'm going into Clean Architecture and lift my Android level from MVC to MVP, introducing DI with Dagger 2, Reactivity with RxJava 2, and of course Java 8.
In MVP clean architecture there is a layer between the entities (in datastores) and the…
14
votes
1 answer
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 talking about:
Lets say I have a small application…
David Mason
- 321
13
votes
4 answers
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 mission is PLANNED, IN_PROGRESS, COMPLETED,…
Mehdi Charife
- 447
13
votes
4 answers
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 views: a CLI and a Web, for instance. If you…
12
votes
3 answers
Should business logic be in the app or in the backend?
I've recently started applying the Clean Architecture while developing an Android application. And so I divided my application in 4 different parts.
Data layer
Contains the implementation of repositories.
Device layer
Contains implementation of…
Ludvig W
- 231
11
votes
2 answers
To which Clean Architecture layer should repositories implementations belong?
It's very common to see this use of repository in projects using clean architecture:
interface Hero { }
interface HeroRepository {
findById(id: number): Hero;
}
class FetchHeroUseCase {
constructor(private heroRepository: HeroRepository)…
Vitor Figueredo Marques
- 329
- 1
- 2
- 6
11
votes
3 answers
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 SDK.
Looking at both of these images raises the…
oren
- 297
11
votes
1 answer
Clean Architecture and Microservices
Our team is in the planning stages of creating an enterprise solution for our back office. Our goal is to have one singular entry point for common tasks, such as changing an address or reprojecting a loan (we're an FI). We want several front-ends…
Brian Chambers
- 243
10
votes
1 answer
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 small applications, but the project is going to…
SeyyedKhandon
- 251
- 2
- 9
10
votes
3 answers
Clean Architecture: Dependency Rule and Libraries/Frameworks
In Clean Architecture by Robert C. Martin the dependency rule points strictly from the outermost layer/ring to the innermost.
As an example a Dependency Injection Framework should lie on the outermost layer (frameworks) to allow for it to be…
Kevin Streicher
- 371
9
votes
4 answers
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 finding the hyperplane that maximizes a measure of…
Mehdi Charife
- 447