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
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
Wym there are different questions?
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
"What do you guys think of SOLID" and "So I did this thing, should I do it differently"
đ
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 đ¤Ł
anything taken to an extreme is not going to be good for your code
Gotcha, so just gonna find a middle point
yes, generally this is only applied as far as a service being responsible for one logical system, like user management
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.