what is solid principles in c

11 months ago 20
Nature

SOLID is a set of principles for object-oriented programming that aim to improve the design and maintainability of software. The SOLID acronym stands for the following five principles:

  • Single Responsibility Principle (SRP): A class should have only one reason to change, meaning that a class should have only one job.
  • Open/Closed Principle (OCP): Software entities should be open for extension but closed for modification.
  • Liskov’s Substitution Principle (LSP): Objects of a superclass should be substitutable with objects of its subclasses without causing any errors.
  • Interface Segregation Principle (ISP): Do not force any client to implement an interface that is irrelevant to them. Instead, focus on avoiding fat interfaces and give preference to many small client-specific interfaces.
  • Dependency Inversion Principle (DIP): High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions.

These principles establish practices that lend to developing software with considerations for maintaining and extending as the project grows. Adopting these practices can also contribute to avoiding code smells, refactoring code, and Agile or Adaptive software development. While these principles can apply to various programming languages, the sample code contained in some articles uses PHP or C# .