AbstractLoggerService should be defined in the higher scope
DScheglov opened this issue · comments
import { AbstractLoggerService } from "../logger"
violates DIP, that points:
A. High-level modules should not depend on low-level modules. Both should depend on abstractions (e.g., interfaces)
B. Abstractions should not depend on details. Details (concrete implementations) should depend on abstractions.
(https://en.wikipedia.org/wiki/Dependency_inversion_principle)
So, the point "A" is violated.
Yep, you are right, and I told about it at video :) We need CoreModule for this, but it out of main ideas of workshop and complicated for beginners.
Yep, you are right, and I told about it at video :) We need CoreModule for this, but it out of main ideas of workshop and complicated for beginners.
I guess we can extract interfaces without extra explanation why. Then beginners will use such approach as just a pattern.
And I guess such extraction doesn't complicate the DI sample too much.
And actually we cannot ignore DIP when we talk about DI, because DIP is a reason for DI (from SOLID point of view).
I guess we can extract interfaces without extra explanation why.
I told about it :) This is just example for Nest.js IoC (and, of course with all Nest IoC problems). For many reasons I prefer not to use Nest.js IoC in real projects except of Application Layer. Thats why I can forget about DIP violations.
Well, do you mean minor remark that "Logger is a System module"?
The first, not all of who reads the code have seen the Workshop video. So, they will be out of scope
The second, it was just a small sentence without emphases, so it is quite easy to skip it (It takes me three times to find the remark).
And, ... ) I don't think the issue is about the video and not about the past. It's about the future )
I guess it is better to use patterns postponing (or omitting) the explanation rather then simplify code with anti-patterns.
Maybe I made an article )