<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Solid on Java &amp; Software Architecture Knowledge Hub</title><link>https://samirsahoo.github.io/design-patterns-hub/tags/solid/</link><description>Recent content in Solid 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/solid/index.xml" rel="self" type="application/rss+xml"/><item><title>Dependency Injection in Java</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/dependency-injection/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/dependency-injection/</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;&lt;strong&gt;Dependency injection (DI)&lt;/strong&gt; means an object receives the objects it works with — its &lt;em&gt;dependencies&lt;/em&gt; — from outside, instead of creating or looking them up itself.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Without DI: the service decides which notifier it uses.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Notifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;notifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;EmailNotifier&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// With DI: whoever creates the service decides.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;OrderService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Notifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;notifier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;notifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;notifier&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That is the entire idea. Frameworks such as Spring automate the wiring, but DI itself needs no framework.&lt;/p&gt;</description></item><item><title>SOLID Principles Explained</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/solid-principles/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/solid-principles/</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;&lt;strong&gt;SOLID&lt;/strong&gt; is an acronym for five object-oriented design principles. Each one keeps code easy to change:&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;Letter&lt;/th&gt;&#10; &lt;th&gt;Principle&lt;/th&gt;&#10; &lt;th&gt;One-line summary&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;S&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Single Responsibility&lt;/td&gt;&#10; &lt;td&gt;A module should have one reason to change — one actor it answers to.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;O&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Open/Closed&lt;/td&gt;&#10; &lt;td&gt;Add behaviour by adding code, not by editing working code.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;L&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Liskov Substitution&lt;/td&gt;&#10; &lt;td&gt;A subtype must be usable anywhere its supertype is expected.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;I&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Interface Segregation&lt;/td&gt;&#10; &lt;td&gt;Clients should not depend on methods they do not use.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;D&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Dependency Inversion&lt;/td&gt;&#10; &lt;td&gt;Policy should not depend on details; both depend on abstractions.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Robert C. Martin collected these principles around 2000. Michael Feathers later arranged them into the SOLID acronym.&lt;/p&gt;</description></item></channel></rss>