{
    "componentChunkName": "component---src-templates-post-js",
    "path": "/blog/solid-principles-checklist",
    "result": {"data":{"markdownRemark":{"html":"<p>With so many soliloquies of SOLID Principles online, ripe with the same old definitions, theoretical verbosity, and yet, the most basic of examples, I’ve always found it difficult to digest and keep it all in mind while developing.</p>\n<p>So I wanted to create a condensed checklist that is wall hang-worthy.</p>\n<h2>SOLID Principles Checklist</h2>\n<ul>\n<li>SOLID is a means to an end, not an end in itself</li>\n<li>The end is maintainability.</li>\n<li>SOLID dogmatism should not dirty the code with Needless Complexity</li>\n</ul>\n<h2>Single Responsibility Principle</h2>\n<ul>\n<li>Each class does one thing and does one thing well</li>\n<li>Each method in a class does one thing and does one thing well</li>\n<li>If a classes’ behavior ever changed, it should impact most of its methods</li>\n<li>Aim for short enough methods that can fit on your screen</li>\n<li>Avoid numerous parameters in methods</li>\n</ul>\n<h2>Open Closed Principle</h2>\n<p>When adding a new functionality</p>\n<ul>\n<li>Base entities aren’t modified (closed for modification)</li>\n<li>Other entities extend the base entity (open for extension)</li>\n<li>Use interface, a module in Python, as the base entity</li>\n<li>Opt for composition over inheritance when an interface is not enough</li>\n</ul>\n<h2>Liskov Substitution Principle</h2>\n<p>In class inheritance</p>\n<ul>\n<li>Subclass add to the base class’s behavior</li>\n<li>Subclass doesn’t replace the base class’s behavior</li>\n<li>Parent instance is replaceable with any of child instances w/o side effects</li>\n</ul>\n<h2>Interface Segregation Principle</h2>\n<ul>\n<li>Base class shouldn’t be generalized</li>\n<li>A class shouldn’t have any methods it doesn’t use</li>\n<li>Multiple interfaces, modules in Python, are better than one</li>\n</ul>\n<h2>Dependency Inversion Principle</h2>\n<ul>\n<li>A class shouldn’t depend on a specific type of class</li>\n<li>Avoid changing the class implementation because of a dependency</li>\n<li>The dependency should be abstracted (generalized)</li>\n<li>Use Dependency Injection</li>\n<li>OCP + LSP = DIP!</li>\n</ul>\n<h3>Further Readings</h3>\n<p>Following is a famous visualisation of the SOLID principles by a Medium author.\r\n<a href=\"https://medium.com/backticks-tildes/the-s-o-l-i-d-principles-in-pictures-b34ce2f1e898\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The S.O.L.I.D Principles in Pictures by Ugonna Thelma</a></p>\n<p>It is common that we go adrift in the profoundness of the principles and concepts, but they could be readily mastered through constant reminders and learning the perspectives of other great minds.</p>","frontmatter":{"title":"SOLID Principles Checklist (in Python)","description":"With so many soliloquies of SOLID Principles online","date":"2020-09-20T00:00:00.000Z","slug":"/blog/solid-principles-checklist","tags":["Blogging","Tech"]}}},"pageContext":{}},
    "staticQueryHashes": ["2009693873","2077189868","3303540520","3505212370","3825832676"]}