{"id":1123,"date":"2023-03-29T11:18:48","date_gmt":"2023-03-29T19:18:48","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=1123"},"modified":"2023-03-29T11:30:45","modified_gmt":"2023-03-29T19:30:45","slug":"design-patterns-structural","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=1123","title":{"rendered":"Design Patterns : Structural"},"content":{"rendered":"<p>(Adapt Face for Decoration and cross a Bridge with help of Proxy)<\/p>\n<p><strong>Adapter Design Pattern (Structural) :<\/strong><br \/>\nConvert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn&#8217;t otherwise because of incompatible interfaces.<br \/>\nWrap an existing class with a new interface.<br \/>\nImpedance match an old component to a new system<\/p>\n<p>Example: Adapter for electronic devices<\/p>\n<p><strong>Facade Design Pattern (Structural): <\/strong><br \/>\nProvide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.<br \/>\nWrap a complicated subsystem with a simpler interface.<\/p>\n<p>Example: Consumers encounter a Facade when ordering from a catalog. The consumer calls one number and speaks with a customer service representative. The customer service representative acts as a Facade, providing an interface to the order fulfillment department, the billing department, and the shipping department.<\/p>\n<p><strong>Decorator Design Pattern (Structural)<\/strong><\/p>\n<p>:<br \/>\nAttach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. Add behavior or state to individual objects at run-time. Note that this pattern allows responsibilities to be added to an object, not methods to an object&#8217;s interface.<\/p>\n<p>Example: Attaching a standard disclaimer signature to an email. (signature is the decorator)<br \/>\n<a href=\"http:\/\/java.dzone.com\/articles\/design-patterns-decorator\">http:\/\/java.dzone.com\/articles\/design-patterns-decorator<\/a><\/p>\n<p>Example: assault gun is a deadly weapon on it&#8217;s own. But you can apply certain &#8220;decorations&#8221; to make it more accurate, silent and devastating.<\/p>\n<p><strong>Bridge Design Pattern: <\/strong><br \/>\nDecouple an abstraction from its implementation so that the two can vary independently<\/p>\n<p>Example of Blog and Themes<br \/>\n<a href=\"https:\/\/simpleprogrammer.com\/2015\/06\/08\/design-patterns-simplified-the-bridge-pattern\/\">https:\/\/simpleprogrammer.com\/2015\/06\/08\/design-patterns-simplified-the-bridge-pattern\/<\/a><\/p>\n<p>Example of TV Remote, and TV implementors like Sony, Philips, etc.<br \/>\n<a href=\"http:\/\/java.dzone.com\/articles\/design-patterns-bridge\">http:\/\/java.dzone.com\/articles\/design-patterns-bridge<\/a><\/p>\n<p><strong>Proxy Pattern: <\/strong><br \/>\nis very similar to the Adapter pattern. However, the main difference between bot is that the adapter will expose a different interface to allow interoperability. The Proxy exposes the same interface, but gets in the way to save processing time or memory. Typically, you&#8217;ll want to use a proxy when communication with a third party is an expensive operation, perhaps over a network. The proxy would allow you to hold your data until you are ready to commit, and can limit the amount of times that the communication is called.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(Adapt Face for Decoration and cross a Bridge with help of Proxy) Adapter Design Pattern (Structural) : Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn&#8217;t otherwise because of incompatible interfaces. Wrap an existing class with a new interface. Impedance match an old component to a &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=1123\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Design Patterns : Structural<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1123","post","type-post","status-publish","format-standard","hentry","category-concepts"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/1123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1123"}],"version-history":[{"count":4,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/1123\/revisions"}],"predecessor-version":[{"id":1133,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/1123\/revisions\/1133"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1123"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}