{"id":371,"date":"2019-01-19T00:36:48","date_gmt":"2019-01-19T08:36:48","guid":{"rendered":"https:\/\/doubleecpu.com\/?page_id=371"},"modified":"2019-01-19T00:37:59","modified_gmt":"2019-01-19T08:37:59","slug":"solid-design-patterns","status":"publish","type":"page","link":"https:\/\/doubleecpu.com\/index.php\/shop\/solid-design-patterns\/","title":{"rendered":"Solid Design Patterns"},"content":{"rendered":"\n<p style=\"text-align:left\"><strong>Single Responsibility<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Do one thing and do it well <\/li><li> Lots of small methods and lots of small classes easier to maintain<ul><li>Need to balance granularity and maintainability <\/li><\/ul><\/li><li> Using factory is single place to create things <\/li><li> Should only have one requirement to cause class to change <\/li><li> Easier to find problems and identify what is responsible for error<\/li><\/ol>\n\n\n\n<p><strong>Open-Closed Principle<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Be open for extension and closed for modification <\/li><li> Once a class is done, It is done (only bug fixes can change all other changes create new classes) <\/li><li> Make base classes generic and inherit from base classes for changes <\/li><li> Polymorphic \u2013 Based on interfaces using API, Inheriting the interface and functionality.  <\/li><\/ol>\n\n\n\n<p><strong>Liskov Substitution Principle<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Derived classes can stand in for base classes <\/li><li> Factory provides class that is needed for code <\/li><\/ol>\n\n\n\n<p><strong>Interface Segregation Principle <\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li> Make specific interfaces client specific<\/li><\/ol>\n\n\n\n<p><strong>Dependency Inversion Principle <\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Depend on Abstractions, Not Concrete Implementations<\/li><\/ol>\n\n\n\n<p><strong>Focus on quality of code <\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Don\u2019t Repeat yourself <\/li><li> Eliminate Technical Debt, Extract methods, Leave code cleaner than you found it<\/li><li> Separation of concerns <\/li><li> Think about code and what it is doing <\/li><li> Structural, Behavioral, Procedural Patterns <\/li><li> Program to an interface of classes using adapters <ul><li> Allows to use mock interfaces for testing <\/li><li> Maps one thing to another <\/li><\/ul><\/li><li> Fa\u00e7ade Makes code easier to read <\/li><li> Decorator takes a base and decorates it <ul><li> Not setting values of Class decorating interfacing it recursively <\/li><\/ul><\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Single Responsibility Do one thing and do it well Lots of small methods and lots of small classes easier to maintain Need to balance granularity and maintainability Using factory is single place to create things Should only have one requirement to cause class to change Easier to find problems and identify what is responsible for &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/doubleecpu.com\/index.php\/shop\/solid-design-patterns\/\" class=\"more-link\">Read more<span class=\"screen-reader-text\"> &#8220;Solid Design Patterns&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":22,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-371","page","type-page","status-publish","hentry"],"featured_media_urls":[],"_links":{"self":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/comments?post=371"}],"version-history":[{"count":0,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/371\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/22"}],"wp:attachment":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/media?parent=371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}