Questions tagged [solid]
Mnemonics for set of design principles: Single responsibility, Open-closed, Liskov substitution, Interface segregation, Dependency inversion
406 questions
7 votes
3 answers
546 views
What SOLID principles does the Java List interface challenge?
The Java List<E> interface includes methods, such as add(E) and remove(Object), that work as the names suggest on instances of mutable concrete implementations, such as ArrayList<E> and ...
3 votes
7 answers
556 views
Do I need to create an interface for every service class to follow good design principles?
I'm working on a custom Magento 2 module in my internship, and I'm trying to follow SOLID principles in my code. Right now, my controller actions handle everything: getting request data, processing it,...
5 votes
4 answers
958 views
Is the SRP of SOLID (or any) principle relevant to the grouping of packages?
Specific example question: I am writing multiple different software packages, in different repos, that each do different things. Many of these packages produce something that we want to visualise/plot....
0 votes
1 answer
256 views
Best approach to map user roles dynamically in ASP.NET Core Identity register method?
I'm working on an ASP.NET Core application that uses Identity for user management. I have an AccountService with a Register function, where I accept a RegisterBaseDto that contains the role ...
1 vote
3 answers
268 views
In "Liskov Substitution Principle", is "invariants can't be weakened in a subtype" a kind of "postconditions can't be weakened in a subtype"?
According to Invariant rule in Liskov Substitution Principle, I know one of the form of violation of "Liskov Substitution Principle" is violating "invariants can't be weakened in a ...
0 votes
2 answers
147 views
Dependency injection - passing responsibility for dependency to a Client?
I have long standing argue about dependency injection and SOLID principles with my teammate. We both want to make an Exporter, to export data into various formats. My approach (in PHP): class Exporter ...
3 votes
4 answers
272 views
Does interface segregation principle apply to configuration data holders?
If you have a class representing your applicative config file. Instead of injecting that config class everywhere, would it be good application of interface segregation principle to expose several ...
-1 votes
1 answer
170 views
Will I lose confidence of my code working in mocking dependency injected services? [duplicate]
Let's say that I have a class with a service that is going to be injected at runtime: class Thing { private magic: IMagic; // Magically injected service public doStuff(){ // Do a lot ...