{"id":47308,"date":"2019-02-17T10:48:55","date_gmt":"2019-02-17T09:48:55","guid":{"rendered":"https:\/\/code-maze.com\/?page_id=47308"},"modified":"2021-11-01T10:01:13","modified_gmt":"2021-11-01T09:01:13","slug":"solid-principles","status":"publish","type":"page","link":"https:\/\/code-maze.com\/solid-principles\/","title":{"rendered":"SOLID Principles in C#"},"content":{"rendered":"<p>SOLID principles represent a set of principles that, if implemented properly should improve our code significantly.<\/p>\n<p>As with any other principle in life, we can misuse and overuse every SOLID principle to the point of being counterproductive. Instead of getting an <strong>understandable, maintainable, and flexible code<\/strong>, we could end up with the code that&#8217;s in worse shape than without SOLID.<\/p>\n<p>So, careful consideration and implementing these SOLID principles only where needed is the key to a clean codebase.<\/p>\n<p>SOLID is a mnemonic acronym and each of the letters in it stands for:<\/p>\n<ul>\n<li><a href=\"https:\/\/code-maze.com\/single-responsibility-principle\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>S<\/strong> &#8211; Single Responsibility Principle<\/a><\/li>\n<li><a href=\"https:\/\/code-maze.com\/open-closed-principle\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>O<\/strong> &#8211; Open\/Closed Principle<\/a><\/li>\n<li><a href=\"https:\/\/code-maze.com\/liskov-substitution-principle\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>L<\/strong> &#8211; Liskov Substitution Principle<\/a><\/li>\n<li><a href=\"https:\/\/code-maze.com\/interface-segregation-principle\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>I<\/strong> &#8211; Interface Segregation Principle<\/a><\/li>\n<li><a href=\"https:\/\/code-maze.com\/dependency-inversion-principle\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>D<\/strong> &#8211; Dependency Inversion Principle<\/a><\/li>\n<\/ul>\n<p>The source code for this series of articles can be found in <a href=\"https:\/\/github.com\/CodeMazeBlog\/solid-principles-csharp\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">this GitHub repo<\/a>. You can switch to different branches to get to the different parts of the series.<\/p>\n<p>We hope these articles will help you discern when and how to implement these principles the right way.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SOLID principles represent a set of principles that, if implemented properly should improve our code significantly. As with any other principle in life, we can misuse and overuse every SOLID principle to the point of being counterproductive. Instead of getting an understandable, maintainable, and flexible code, we could end up with the code that&#8217;s in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":54924,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"class_list":["post-47308","page","type-page","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SOLID Principles in C# - Code Maze<\/title>\n<meta name=\"description\" content=\"In this series of articles, we are going to learn how to use different SOLID principles in C# to improve our code significantly.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/code-maze.com\/solid-principles\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SOLID Principles in C# - Code Maze\" \/>\n<meta property=\"og:description\" content=\"In this series of articles, we are going to learn how to use different SOLID principles in C# to improve our code significantly.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/solid-principles\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:modified_time\" content=\"2021-11-01T09:01:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/09\/SOLID-cover.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"620\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/solid-principles\/\",\"url\":\"https:\/\/code-maze.com\/solid-principles\/\",\"name\":\"SOLID Principles in C# - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/solid-principles\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/solid-principles\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/09\/SOLID-cover.png\",\"datePublished\":\"2019-02-17T09:48:55+00:00\",\"dateModified\":\"2021-11-01T09:01:13+00:00\",\"description\":\"In this series of articles, we are going to learn how to use different SOLID principles in C# to improve our code significantly.\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/solid-principles\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/solid-principles\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/solid-principles\/#primaryimage\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/09\/SOLID-cover.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/09\/SOLID-cover.png\",\"width\":1100,\"height\":620,\"caption\":\"SOLID cover\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/code-maze.com\/solid-principles\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SOLID Principles in C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/code-maze.com\/#website\",\"url\":\"https:\/\/code-maze.com\/\",\"name\":\"Code Maze\",\"description\":\"Learn. Code. Succeed.\",\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/code-maze.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/code-maze.com\/#organization\",\"name\":\"Code Maze\",\"url\":\"https:\/\/code-maze.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"width\":3511,\"height\":3510,\"caption\":\"Code Maze\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/CodeMazeBlog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SOLID Principles in C# - Code Maze","description":"In this series of articles, we are going to learn how to use different SOLID principles in C# to improve our code significantly.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/code-maze.com\/solid-principles\/","og_locale":"en_US","og_type":"article","og_title":"SOLID Principles in C# - Code Maze","og_description":"In this series of articles, we are going to learn how to use different SOLID principles in C# to improve our code significantly.","og_url":"https:\/\/code-maze.com\/solid-principles\/","og_site_name":"Code Maze","article_modified_time":"2021-11-01T09:01:13+00:00","og_image":[{"width":1100,"height":620,"url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/09\/SOLID-cover.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@CodeMazeBlog","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/code-maze.com\/solid-principles\/","url":"https:\/\/code-maze.com\/solid-principles\/","name":"SOLID Principles in C# - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/solid-principles\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/solid-principles\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/09\/SOLID-cover.png","datePublished":"2019-02-17T09:48:55+00:00","dateModified":"2021-11-01T09:01:13+00:00","description":"In this series of articles, we are going to learn how to use different SOLID principles in C# to improve our code significantly.","breadcrumb":{"@id":"https:\/\/code-maze.com\/solid-principles\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/solid-principles\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/solid-principles\/#primaryimage","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/09\/SOLID-cover.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/09\/SOLID-cover.png","width":1100,"height":620,"caption":"SOLID cover"},{"@type":"BreadcrumbList","@id":"https:\/\/code-maze.com\/solid-principles\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"SOLID Principles in C#"}]},{"@type":"WebSite","@id":"https:\/\/code-maze.com\/#website","url":"https:\/\/code-maze.com\/","name":"Code Maze","description":"Learn. Code. Succeed.","publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/code-maze.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/code-maze.com\/#organization","name":"Code Maze","url":"https:\/\/code-maze.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","width":3511,"height":3510,"caption":"Code Maze"},"image":{"@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/CodeMazeBlog"]}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/pages\/47308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=47308"}],"version-history":[{"count":3,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/pages\/47308\/revisions"}],"predecessor-version":[{"id":60128,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/pages\/47308\/revisions\/60128"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media\/54924"}],"wp:attachment":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media?parent=47308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}