Questions tagged [clean-architecture]

The Clean Architecture is a software architecture proposed by Robert C. Martin (better known as Uncle Bob). This architecture is similar to the Onion-Hexagonal-DCI-Architecture proposed by their respective authors. The base of this architecture is to follow and obey rules of the 'Dependency Rule'.

The Clean Architecture is proposed by Robert C. Martin, also known as Uncle Bob. This architecture is similar to the Onion, Hexagonal, Screaming, and DCI architectures. Though these architectures all vary somewhat in their details, they are very similar. They all have the same objective, which is the separation of concerns. They all achieve this separation by dividing the software into layers.

clean architecture diagram Robert C. Martin, The Clean Architecture, 2012

The foundation layers of The Clean Architecture are:

  • Entities (Enterprise Business Rules)
  • Use cases (Application Business Rules)
  • Interface Adapters
  • Frameworks and Drivers.

The rules are driven by The Dependency Rule, which states that:

...source code dependencies can only point inwards. Nothing in an inner circle can know anything at all about something in an outer circle. In particular, the name of something declared in an outer circle must not be mentioned by the code in the an inner circle. That includes, functions, classes. variables, or any other named software entity.

Finally, when obeying this rule and using this architecture it is proposed that:

By separating the software into layers, and conforming to The Dependency Rule, you will create a system that is intrinsically testable, with all the benefits that implies.

1110 questions
-1
votes
1 answer

Copy from one object to another - only values from common properties of their interfaces

I have an interface (interfaceA) that has 2 properties and another one (interfaceB) that has 3 properties (The numbers are just for example). I have created an object (type: interfaceB) and I would like to create another object (type: interfaceA)…
StPaulis
  • 2,844
  • 1
  • 14
  • 24
-1
votes
1 answer

Modeling a Net Core Application Using Clean Arch

Well, I have the following flow in my application: Controller --> *call* --> UseCase --> *call* --> UpdateCustomerGateway UpdateCustomerGateway have one method updateCustomer(Customer customer) where Usecase can call database to update the…
Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92
-1
votes
2 answers

Where to trigger Loading in Clean Architeture Swift

Where is the correct place I should put the code that would trigger a loading to display in my app. It is correct to do is on view? since it is displaying something on screen, so it fits as a UI logic class ViewController: UIViewController { func…
-1
votes
1 answer

use case/business logic returning multiple values best practice?

I am implementing a clean architecture in an application. I have a layer where the application/usecase classes which does the business logic and interacts with mutliple outgoing ports (interfaces to adapters for database calls, http api calls etc).…
cani
  • 210
  • 3
  • 10
-1
votes
1 answer

Single responsibility and methods

I think I might answer my own question here but lets say I understand the SRP on the method level to mean that a method serves one role. If I have methods that each individually cover one specific role in my class, but a method that uses lots of…
-1
votes
3 answers

Java more methods or more functionality in a method?

I'm new to programming in Java and am currently working on a program to move a theoretical robot. Would it be more efficient/better practice to have a method like public void turn(String direction, double power) { /* code */ } or like public void…
-1
votes
1 answer

In clean architecture, How to do acceptance testing?

In Android, I'm using clean architecture and putting my code packaged by layer. So I've 4 layers (modules) : app data device domain I know, correct me if I'm wrong, that acceptance testing (Using FitNesse) should replace UI in better words, it…
abd3lraouf
  • 1,438
  • 1
  • 18
  • 24
-2
votes
1 answer

Relating creation and update request use cases to entity in clean architecture REST

Let's say I am building a basic REST allowing CRUD operations on some object type A. I am using clean architecture, so The definition of A itself sits in the Domain layer. This includes any business logic inherent to it, such as a constrained…
-2
votes
1 answer

Is it possible to achieve the "Clean Architecture" using Go or V-lang?

TLDR; Is the "Clean Architecture" popularized by Robert Martin possible with V or Go? My imagination tells me it is but I want to hear about your opinions or actual experiences. Some background: The Clean Architecture is a popular practice among…
jacob
  • 17
  • 5
-2
votes
1 answer

Good practice .Net Core API validation

So lets say we have a AccountController And has a method like this for registering: [HttpPost("register")] public ActionResult Register(RegisterDto user) { try { accountService.Register(user); …
Nesquikk M
  • 121
  • 3
  • 12
-2
votes
1 answer

Android Clean Architecture

I've created a simple android project with Android Studio. How to create layers? I mean data, presentation, domain layers using Android studio.I'm trying to understand how to use Clean Architecture pattern in my Android apps. As I understand to…
msfvenom
  • 17
  • 6
-3
votes
2 answers

What is Clean Architecture in .NET?

What is "Clean Architecture" ? What doesn't qualify as "Clean Architecture" ? Edit - Making this question relevant only to clean Architecture.
amit agarwal
  • 63
  • 2
  • 17
-3
votes
1 answer

Where store Tests (project structure - best practice)?

We have many different ways to implement project structure in GO. My question is where the best way to store tests implementation: separately (as Java Maven/Gradle standard) ├── pkg │ ├── colocator │ │ ├── some_impl.go │ │ └── ... │ ├──…
1 2 3
73
74