textYash
Explore posts from serversEnum based Singleton
This is the description for my job training task:
I don't understand how to implement this. I find myself coding the same old implementation with a static backing field.
Not here to get my homework done. I'm genuinely trying to learn
15 replies
Purpose of Dependency Injection
In this example what's the benefit of DI here. I can just create instances of
EmailService
and MessagingService
class and call the SendMessage
method on them without having to create an extra instance of the NotificationService
class.
I asked AI then it just mentioned:
1. some theoretical information about how DI has loose coupling and all but couldn't prove any benefit in the code.
2. how I can independently test the NotificationService
but I can just independently test MessagingService
& EmailService
.
3. how adding features to the MessagingService
& EmailService
can cause problems but couldn't show me how it can cause problems in the code.24 replies
DTDrizzle Team
•Created by textYash on 4/11/2024 in #help
How to call a method based on a condition?
I am running two almost similar queries based on a condition. In one of the condition I'm calling the where method and in the other one I'm not. How can I reduce duplicacy by having just one query that works for both conditions? Basically calling the where method only if a condition holds.
4 replies