3 ms·
I don't think this is a very good example of clean architecture; this is just a refactoring that extracts three methods. There's no dependency inversion used he
by hyko 6y ago
I don't think this is a very good example of clean architecture; this is just a refactoring that extracts three methods. There's no dependency inversion used here, which is one of the key tools you would use to create a clean architecture. The use case itself depends directly on the functionality in requests, which means the business logic is coupled to the concrete details of the requests API.
Clean architecture also differs from n-tier in that–although there are layers, they don't have to be physically distinct and the APIs between them are not typically heavyweight gateways designed to work across network boundaries etc. The key design activity in CA is reducing the coupling between abstract business logic and the concrete code that executes it. It's actually quite a simple approach to describe, but more difficult in practice.
There's nothing particularly wrong with the first function; functions certainly don't only have to "do one thing" in clean architecture.