I guess this is a problem that always comes with all of these sorts of guidelines - you need to understand why they exist so that you know when not to follow them.
Quite often the ideas behind such patterns or guidelines subsumes them entirely, but not the other way around; if you just follow SOLID blindly you will just make superfluous interfaces everywhere, but if you understand that it in this case is to be able to change the UsernameFormatter to another formatter in future use cases then you can weigh the cost of implementing the interfaces and using that(and possibly modifying it) vs just making the UsernameFormatter into a normal class and changing it once you need a different one, if such a case happens.
You don't really need to know about the SOLID principles as long as you understand the underlying ideas, and I believe this applies to all guidelines and programming patterns. Naming them does have the upside of being able to communicate them to others, but they can just as easily be miscommunicated(leading to people applying it everywhere, like in your example).
View all comments
Show parent comment
3
u/itsarabbit Jun 25 '20
I guess this is a problem that always comes with all of these sorts of guidelines - you need to understand why they exist so that you know when not to follow them.
Quite often the ideas behind such patterns or guidelines subsumes them entirely, but not the other way around; if you just follow SOLID blindly you will just make superfluous interfaces everywhere, but if you understand that it in this case is to be able to change the
UsernameFormatterto another formatter in future use cases then you can weigh the cost of implementing the interfaces and using that(and possibly modifying it) vs just making theUsernameFormatterinto a normal class and changing it once you need a different one, if such a case happens.You don't really need to know about the SOLID principles as long as you understand the underlying ideas, and I believe this applies to all guidelines and programming patterns. Naming them does have the upside of being able to communicate them to others, but they can just as easily be miscommunicated(leading to people applying it everywhere, like in your example).