<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Structural on Java &amp; Software Architecture Knowledge Hub</title><link>https://samirsahoo.github.io/design-patterns-hub/tags/structural/</link><description>Recent content in Structural on Java &amp; Software Architecture Knowledge Hub</description><generator>Hugo</generator><language>en-US</language><copyright>© 2026 Samir Kumar Sahoo (https://github.com/samirsahoo). All rights reserved.</copyright><atom:link href="https://samirsahoo.github.io/design-patterns-hub/tags/structural/index.xml" rel="self" type="application/rss+xml"/><item><title>Adapter vs Decorator vs Proxy vs Facade</title><link>https://samirsahoo.github.io/design-patterns-hub/comparisons/adapter-decorator-proxy-facade/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/comparisons/adapter-decorator-proxy-facade/</guid><description>&lt;h2 id="the-deciding-question"&gt;The deciding question&lt;a class="heading-anchor" href="#the-deciding-question" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;All four patterns put an object in front of another object. They differ in &lt;strong&gt;why&lt;/strong&gt;:&lt;/p&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Pattern&lt;/th&gt;&#10; &lt;th&gt;The wrapper exists to…&lt;/th&gt;&#10; &lt;th&gt;Interface towards the client&lt;/th&gt;&#10; &lt;th&gt;Wraps&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Adapter&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;em&gt;translate&lt;/em&gt; an incompatible interface&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Different&lt;/strong&gt; from the wrapped object&amp;rsquo;s&lt;/td&gt;&#10; &lt;td&gt;One object&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Decorator&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;em&gt;add&lt;/em&gt; behaviour while keeping the interface&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Same&lt;/strong&gt; as the wrapped object&amp;rsquo;s&lt;/td&gt;&#10; &lt;td&gt;One object (stackable)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Proxy&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;em&gt;control access&lt;/em&gt; to the real object&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Same&lt;/strong&gt; as the real object&amp;rsquo;s&lt;/td&gt;&#10; &lt;td&gt;One object&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Facade&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;em&gt;simplify&lt;/em&gt; a complex subsystem&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;New&lt;/strong&gt;, simpler interface&lt;/td&gt;&#10; &lt;td&gt;Many objects&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;aside class="callout callout--key" role="note"&gt;&#10; &lt;p class="callout__title"&gt;&lt;span class="callout__label"&gt;Key concept&lt;/span&gt;&lt;span class="callout__heading"&gt;Ask two questions&lt;/span&gt;&lt;/p&gt;&#10; &lt;div class="callout__body"&gt;&lt;ol&gt;&#10;&lt;li&gt;Does the client see the &lt;strong&gt;same interface&lt;/strong&gt; as the wrapped object? If not, it is an Adapter or a Facade.&lt;/li&gt;&#10;&lt;li&gt;Is the purpose to &lt;strong&gt;add behaviour&lt;/strong&gt; (Decorator), &lt;strong&gt;control access&lt;/strong&gt; (Proxy), &lt;strong&gt;translate&lt;/strong&gt; (Adapter) or &lt;strong&gt;simplify&lt;/strong&gt; (Facade)?&lt;/li&gt;&#10;&lt;/ol&gt;&lt;/div&gt;&#10;&lt;/aside&gt;</description></item><item><title>All 23 GoF Patterns: Overview and Classification</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/gof-overview/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/gof-overview/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Gang of Four (GoF) catalogue&lt;/strong&gt; is the set of 23 object-oriented design patterns published in &lt;em&gt;Design Patterns: Elements of Reusable Object-Oriented Software&lt;/em&gt; (1994). The book sorts them along two axes:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Purpose&lt;/strong&gt; — what the pattern does: &lt;em&gt;creational&lt;/em&gt;, &lt;em&gt;structural&lt;/em&gt; or &lt;em&gt;behavioral&lt;/em&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Scope&lt;/strong&gt; — whether the relationships are fixed at compile time through inheritance (&lt;em&gt;class&lt;/em&gt; scope) or set up at runtime through composition (&lt;em&gt;object&lt;/em&gt; scope).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This page is the map. Each pattern gets its own article; patterns not yet written are listed as plain text so that no page pretends to be finished.&lt;/p&gt;</description></item><item><title>Adapter Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/adapter/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/adapter/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Adapter&lt;/strong&gt; pattern lets code work with a class whose interface does not match what the code expects. The adapter implements the interface the client wants and translates every call into the interface the existing class provides.&lt;/p&gt;</description></item><item><title>Bridge Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/bridge/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/bridge/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Bridge&lt;/strong&gt; pattern separates &lt;em&gt;what&lt;/em&gt; something does (the &lt;strong&gt;abstraction&lt;/strong&gt;) from &lt;em&gt;how&lt;/em&gt; it is done (the &lt;strong&gt;implementation&lt;/strong&gt;) into two class hierarchies. The abstraction holds a reference to an implementation object; that reference is the &amp;ldquo;bridge&amp;rdquo;. Both sides can then be extended independently.&lt;/p&gt;</description></item><item><title>Composite Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/composite/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/composite/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Composite&lt;/strong&gt; pattern arranges objects in a &lt;strong&gt;tree&lt;/strong&gt; and gives single objects (leaves) and groups (composites) the &lt;strong&gt;same interface&lt;/strong&gt;. Client code can then call &lt;code&gt;price()&lt;/code&gt; on a single product or on a bundle of bundles without caring which it has.&lt;/p&gt;</description></item><item><title>Decorator Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/decorator/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/decorator/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Decorator&lt;/strong&gt; pattern adds behaviour to an object by &lt;strong&gt;wrapping&lt;/strong&gt; it in another object that implements the &lt;strong&gt;same interface&lt;/strong&gt;. The wrapper does its extra work and forwards the call to the wrapped object. Wrappers can be stacked, and each adds one responsibility.&lt;/p&gt;</description></item><item><title>Facade Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/facade/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/facade/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Facade&lt;/strong&gt; pattern provides &lt;strong&gt;one simple interface&lt;/strong&gt; to a set of classes that together form a subsystem. Clients call the facade; the facade knows which subsystem objects to call and in what order.&lt;/p&gt;&#10;&lt;p&gt;GoF intent: &lt;em&gt;&amp;ldquo;Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.&amp;rdquo;&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Flyweight Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/flyweight/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/flyweight/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Flyweight&lt;/strong&gt; pattern saves memory when a program needs a very large number of similar objects. It splits each object&amp;rsquo;s state into:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;intrinsic state&lt;/strong&gt;: shared, immutable and independent of context, stored once in a shared flyweight object&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;extrinsic state&lt;/strong&gt;: varies per object and is stored (or passed in) by the context.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;A &lt;strong&gt;factory&lt;/strong&gt; makes sure each distinct flyweight exists only once.&lt;/p&gt;</description></item><item><title>Proxy Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/proxy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/proxy/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Proxy&lt;/strong&gt; pattern puts a &lt;strong&gt;stand-in object&lt;/strong&gt; in front of a real object. The proxy implements the same interface, so clients cannot tell the difference, and it decides when and whether to forward each call: creating the real object lazily, checking permissions, caching results or calling across a network.&lt;/p&gt;</description></item></channel></rss>