C
C#•7mo ago
ItaM

What are you guys take in SOLID?

\ Its injecting an interface with three methods and only using one an anti pattern? Should I bother re-factoring to smaller chunks to make sure I am using all the methods I am injecting? Does solid even matters?
9 Replies
Monsieur Wholesome
Monsieur Wholesome•7mo ago
Those are very different questions SOLID is a holy grail for best-case programming with infinite time resources to always do everything right Reality is far from it though, so you will break it inevitably at some point It ain't that bad to break it
ItaM
ItaMOP•7mo ago
Wym there are different questions?
Jimmacle
Jimmacle•7mo ago
you're asking about breaking up services so they're 100% used in every place they're injected, which isn't really SOLID and is not something you need to do anyway you'll end up with a bunch of services with single methods and duplicating code and creating a bunch of new problems
Monsieur Wholesome
Monsieur Wholesome•7mo ago
"What do you guys think of SOLID" and "So I did this thing, should I do it differently" 😆
ItaM
ItaMOP•7mo ago
You mean breaking up those services isnt really SOLID? Lets say that we have an interface where we have 3 methods And we call that interface but we are only using one of the three methods, doesnt that violates the interface segregation principle? I know if I break up my application in services that are 100% used I will have a bunch of services and will end up being very cumbersome Well yeah they're pretty different questiosn 🤣
Jimmacle
Jimmacle•7mo ago
anything taken to an extreme is not going to be good for your code
ItaM
ItaMOP•7mo ago
Gotcha, so just gonna find a middle point
Jimmacle
Jimmacle•7mo ago
yes, generally this is only applied as far as a service being responsible for one logical system, like user management
Philip
Philip•7mo ago
You are not asking different questions at all, and you clearly have understood the SOLID principles, whenever you’ve read about them. Your concern is absolutely right, since you would technically need to split up all classes, interfaces, methods, etc. in ridiculous ways in the name of “doing one thing” and “SOLID” design. However, that’s a very dubious way to write an application, as it will only introduce complexity and technical debt. I personally only make use of OCP, LSP, and DIP (my favourite). The other ones are ways to make a lot of nuisance for yourself.
Want results from more Discord servers?
Add your server