mnemonics for set of design principles: Single responsibility, Open-closed, Liskov substitution, Interface segregation, Dependency inversion
53
votes
6answers
3k views
Is this a violation of the Liskov Substitution Principle?
Say we have a list of Task entities, and a ProjectTask sub type. Tasks can be closed at any time, except ProjectTasks which cannot be closed once they have a status of Started. The UI should ensure ...
24
votes
3answers
808 views
Are static classes with static methods considered SOLID?
SOLID includes the Liskov substitution princicple
which has the notion that “objects in a program should be replaceable with instances of their subtypes without altering the correctness of that ...
21
votes
10answers
2k views
How many are too many interfaces on a class?
I would probably consider it a code smell or even an anti-pattern to have a class that implements 23 interfaces. If it is indeed an anti-pattern, what would you call it? Or is it simply just not ...
21
votes
11answers
883 views
Choose code design effort or laziness in Bank world
I've worked for two years in a great Investment Bank.
I made some technical projects with the desire of creating code the most optimized, respecting the adapted good design patterns, SOLID principle, ...
19
votes
3answers
10k views
Programming SOLID Principles
Over time I could understand two parts of SOLID – the “S” and “O”.
“O” – I learned Open Closed Principle with the help of Inheritance and Strategy Pattern.
“S” – I learned Single Responsibility ...
18
votes
5answers
1k views
LSP vs OCP / Liskov Substitution VS Open Close
I am trying to understand the SOLID principles of OOP and I've come to the conclusion that LSP and OCP have some similarities (if not to say more).
the open/closed principle states "software ...
15
votes
4answers
1k views
Solid principles vs YAGNI
When do the SOLID principles become YAGNI?
As programmers we make trade-offs all the time, between complexity, maintainability, time to build and so forth. Amongst others, two of the smartest ...
15
votes
3answers
624 views
How is dependency inversion related to higher order functions?
Today I've just seen this article which described the relevance of SOLID principle in F# development-
F# and Design principles – SOLID
And while addressing the last one - "Dependency inversion ...
12
votes
11answers
646 views
SOLID vs. Avoiding Premature Abstraction
I understand what SOLID is supposed to accomplish and use it regularly in situations where modularity is important and its goals are clearly useful. However, two things prevent me from applying it ...
12
votes
2answers
531 views
Equivalent of SOLID principles for functional programming
I've found the SOLID principles quite useful when thinking about object-oriented design.
Is there a similar / equivalent set of language-agnostic principles tailored for functional programming?
11
votes
5answers
1k views
What are the design principles that promote testable code? (designing testable code vs driving design through tests)
Most of the projects that I work on consider development and unit testing in isolation which makes writing unit tests at a later instance a nightmare. My objective is to keep testing in mind during ...
11
votes
4answers
684 views
Where should you put constants and why?
In our mostly large applications, we usually have a only few locations for constants:
One class for GUI and internal contstants (Tab Page titles, Group Box titles, calculation factors, enumerations)
...
10
votes
7answers
1k views
What can go wrong if the Liskov substitution principle is violated?
I was following this highly voted question on possible violation of Liskov Substitution principle. I know what the Liskov Substitution principle is, but what is still not clear in my mind is what ...
10
votes
9answers
870 views
SOLID vs. static methods
Here's a problem I frequently run into: Let there be a web shop project that has a Product class. I want to add a feature which allows users to post reviews to a product. So I have a Review class ...
10
votes
4answers
748 views
Does test-driven development force me to follow SOLID?
I hear a lot from TDD practitioners that one of TDD's advantages is that it forces developers to follow SOLID principles (Single responsibility, Open-closed, Liskov substitution, Interface segregation ...