sergdort / CleanArchitectureRxSwift

Example of Clean Architecture of iOS app using RxSwift
MIT License
3.88k stars 494 forks source link

You don't seem to understand Clean Architecture #72

Open mycroftcanner opened 4 years ago

mycroftcanner commented 4 years ago

Your domain has entities... but they have absolutely no logic or critical business rules associated to them... it only defines entities and a use case provider protocol...

You have 3 redundant use cases provider implementations that are fully aware of everything and can't talk to each other.

Use cases implementation should have no knowledge about core data, realm, etc... you just write platform agnostic code... using protocols and inject adapters as dependencies.

mycroftcanner commented 4 years ago

CleanCodeRxSwift would be a better name for this repo.

You write clean code I give you that! But calling this clean architecture is a misnomer and would only confuse people.

sergdort commented 4 years ago

Your domain has entities... but they have absolutely no logic or critical business rules associated to them... it only defines entities and a use case provider protocol...

I agree, the reason why domain in this example is “empty” module with no implementation, is because I wanted to implement 3 different concrete implement of the same domain and put them into separate module. In real app I would definitely not do that, I’d have domain which hides implementation detains behind adstraction, what I mean that all concrete usecases would be there and accessed via Service locator or any other DI pattern.

But calling this clean architecture is a misnomer and would only confuse people.

The reason I called it Clean Arch is because it’s literally implementation of what Uncle Bob was talking about here https://youtu.be/Nsjsiz2A9mg and it uses RxSwift 🤷‍♂️

sergdort commented 4 years ago

You have 3 redundant use cases provider implementations that are fully aware of everything and can't talk to each other.

I don’t agree here, unless I’m missing something, all concrete use cases are internal and sit in separate modules, the only way to create them are via corresponding use cases providers

dineshflock commented 2 years ago

I see that efforts have been put to implement Uncle Bob's Clean arch, but I agree with @mycroftcanner that this is not clean architecture.

In clean arch we have domain that has implementations of uses cases along with interfaces of use cases. Use case implementations(part of Domain layer) should never depend on DB as Domain should not depend on anything.

sergdort commented 2 years ago

Use case implementations(part of Domain layer) should never depend on DB as Domain should not depend on anything

I’m struggle to understand how in this case the Domain is dependent on anything? It sits in separate module and does not know anything about the implementation of a DB

BarryDuggan commented 2 years ago

@mycroftcanner
I'm learning about repository pattern in swift. My understanding isnt good enough yet to understand this discussion fully.

Not to take away from the great work done in this repo but could you point me toward an example of what 'you' think repository pattern in clean architecture should look like? A link to an article or book on amazon would be great