-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some Architechture Concerns #1752
Comments
Import/export (common.js and esm modules) are actually far from clean architecture, because you need to know certain places where other modules located. It's a hardcoded paths (worst case) or dependency locator (best case). But we need dependency injection for low coupling. It's ok to me to have coupling with interfaces (but not from certain files). It's not acceptable to have coupling with not abstract code from certain files. We use v8 sandboxes for DI to build namespaces like Last example is short so putting logic to api handler is ok, bit for larger apps we need domain services located in
|
it is not correct. To import some utilities from certain place doesn't counter the clean architecture. More then it is much better then inject (in any way) absolutely everything. Clean Architechture doesn't mean absolutely low-coupled code. It means architecture supports incremental development without rewriting the existing code base
What is an issue with importing interfaces from some specific file? It is a matter of compiler (transpiler). And actually it is dificult to imagine more abstract code then interface
The Express developers had such considerations too :)
|
Hey, @tshemsedinov
Let's look on the sample code.
It seems the same as an old-school express-handler:
However, the last one contains the dependency contract but the first one requires code to be read and analyzied to get aware about the dependencies. Impress uses implicit service locator to inject dependencies, so the dependency contracts are always hidden.
Both samples implement business logic inside of the infrastructure level. More then the DB is accessed directly from the request controller,
I guess the good example for that should look like that:
./src/use-cases/get-cities-by-country-id.ts
So, what do you think about to make impress more freandly to clean architecture?
The text was updated successfully, but these errors were encountered: