Can anyone explain what are solid principles with .NET development?
Loading
Can anyone explain what are solid principles with .NET development?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaish MathewsPosted Dec 3, 2024, 7:15 AM
The SOLID principles are a set of design principles aimed at creating robust, maintainable, and scalable software. They are especially relevant in object-oriented programming and are widely adopted in .NET development. Here's an overview of the SOLID principles:
Below are the details I consolidated from multiple sources.
1. Single Responsibility Principle (SRP)
Definition: A class should have only one reason to change.
2. Open/Closed Principle (OCP)
Definition: Software entities (classes, modules, functions) should be open for extension but closed for modification.
LoggerService.3. Liskov Substitution Principle (LSP)
Definition: Objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program.
Squareoverrides behavior to ensure it can substituteRectanglewithout breaking functionality.4. Interface Segregation Principle (ISP)
Definition: A class should not be forced to implement interfaces it doesn't use.
BasicPrinterdoesn't need to implementIScanner.5. Dependency Inversion Principle (DIP)
Definition: High-level modules should not depend on low-level modules. Both should depend on abstractions.
BusinessLogicclass depends on theIDataAccessinterface, allowing flexible implementations.Why Use SOLID Principles in .NET Development?
By adhering to SOLID principles, .NET developers can create applications that are more robust, modular, and easier to work with over time.
You can accept this answer if this helps.
Kiran KumarPosted Dec 4, 2024, 4:55 PM
Hi Mathew
I am fine with your suggestion that SOLID is different from Pattrens
I have analyzed each individual principle and find few observations
If you closely look at the OCP ISP and IDP, the code looks same so why it is similar code except IDP has multiple inheritance, the remaining everything same right
I Agree that it is a principle we have to go with programming logic designed by Microsoft, but just to confirm are these 3 principles specific to interface based implementation
Jaish MathewsPosted Dec 3, 2024, 3:57 PM
OOPS is programming paradigm based on the concept of "objects" that contain data (fields) and code (methods).
SOLID is design principles aimed at improving the maintainability, scalability, and flexibility of software.
Object-Oriented Programming (OOP) is the foundational paradigm upon which SOLID principles are built.
Also,
I recommend referencing multiple documents to ensure all aspects are thoroughly understood. Becasue here can't cover all these.
Kiran KumarPosted Dec 3, 2024, 11:52 AM
Hi Mathew
Thanks for the detail explanations I think I need to go one by one and implement that in real time features , I will let you know if need any clarification First I go with SRP principle
Before going into it, I need a few clarifications,
I know the OOPS concepts so how different it from four object principles that I know , As I can see in the title you mentioned these are relevant to OOPS, however, can explain if you have details little more relation with oops principles
Also, I know Singleton pattern and DI (I think you mentioned it as DIP inversion) in my project experience, so just want to know is that SOLID pattern or principles
Please clarify to get a better idea about these principles