{"id":133,"date":"2024-01-23T07:50:16","date_gmt":"2024-01-23T07:50:16","guid":{"rendered":"https:\/\/ramanjawade.com\/?p=133"},"modified":"2024-01-23T07:50:45","modified_gmt":"2024-01-23T07:50:45","slug":"solid-design-principles","status":"publish","type":"post","link":"https:\/\/ramanjawade.com\/?p=133","title":{"rendered":"SOLID Design Principles"},"content":{"rendered":"\n<p>The SOLID principles are a set of five design principles that, when followed, contribute to creating maintainable, scalable, and flexible software. These principles were introduced by Robert C. Martin and are widely used in object-oriented programming. The SOLID acronym stands for:<\/p>\n\n\n\n<ol>\n<li><strong>Single Responsibility Principle (SRP):<\/strong>\n<ul>\n<li>A class or module should have only one reason to change, meaning it should have only one responsibility or job. This helps in keeping the code focused, making it easier to understand, test, and maintain. When a class has multiple responsibilities, changes to one responsibility may inadvertently affect the others.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Open\/Closed Principle (OCP):<\/strong>\n<ul>\n<li>Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification. This means that you can add new features or functionalities without altering existing code. This is achieved through the use of abstraction, polymorphism, and design patterns like inheritance and composition.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Liskov Substitution Principle (LSP):<\/strong>\n<ul>\n<li>Objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program. This principle ensures that inheritance is used appropriately, and derived classes can be used wherever their base classes are used. Violating this principle can lead to unexpected behavior.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Interface Segregation Principle (ISP):<\/strong>\n<ul>\n<li>A class should not be forced to implement interfaces it does not use. Large, monolithic interfaces should be broken down into smaller, specific interfaces so that clients can depend only on the interfaces that are relevant to them. This prevents classes from being burdened with unnecessary methods.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Dependency Inversion Principle (DIP):<\/strong>\n<ul>\n<li>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. This principle promotes loose coupling and flexibility by relying on abstractions (interfaces or abstract classes) instead of concrete implementations.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>The SOLID principles are a set of five design principles that, when followed, contribute to creating maintainable, scalable, and flexible software. These principles were introduced by Robert C. Martin and are widely used in object-oriented programming. The SOLID acronym stands for:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/ramanjawade.com\/index.php?rest_route=\/wp\/v2\/posts\/133"}],"collection":[{"href":"https:\/\/ramanjawade.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ramanjawade.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ramanjawade.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ramanjawade.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=133"}],"version-history":[{"count":1,"href":"https:\/\/ramanjawade.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/ramanjawade.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/ramanjawade.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ramanjawade.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ramanjawade.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}