<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Design Patterns on Khalid9ASSI</title><link>https://khalid9assi.com/tags/design-patterns/</link><description>Recent content in Design Patterns on Khalid9ASSI</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 27 Jul 2025 14:30:00 +0100</lastBuildDate><atom:link href="https://khalid9assi.com/tags/design-patterns/index.xml" rel="self" type="application/rss+xml"/><item><title>Decorators design pattern</title><link>https://khalid9assi.com/posts/decorators-design-pattern/</link><pubDate>Sun, 27 Jul 2025 14:30:00 +0100</pubDate><guid>https://khalid9assi.com/posts/decorators-design-pattern/</guid><description>&lt;p&gt;In software development, we often need to add extra behavior to existing functions without changing their original code. Common examples include logging, authentication, validation, caching, and performance tracking.&lt;/p&gt;
&lt;p&gt;A beginner solution is usually copying the same logic into multiple functions. While this works at first, it quickly creates repeated code, cluttered functions, and maintenance problems. This is where the &lt;strong&gt;Decorator Pattern&lt;/strong&gt; becomes useful.&lt;/p&gt;
&lt;h2 id="what-is-the-decorator-pattern" class="relative group"&gt;What is the Decorator Pattern? &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#what-is-the-decorator-pattern" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The &lt;strong&gt;Decorator Pattern&lt;/strong&gt; is a structural design pattern that allows developers to dynamically add new behavior to existing objects or functions without modifying their original implementation.&lt;/p&gt;</description></item></channel></rss>