<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 15:06:07 +0000</lastBuildDate>
    <item>
      <title>(JavaScript) JavaScript Basic Decorator Pattern - timsommer</title>
      <link>https://snipplr.com/view/66521/javascript-basic-decorator-pattern</link>
      <description>&lt;p&gt;In this section we're going to explore the decorator - a structural design pattern that promotes code reuse and is a flexible alternative to subclassing. This pattern is also useful for modifying existing systems where you may wish to add additional features to objects without the need to change the underlying code that uses them. &#13;
&#13;
Traditionally, the decorator is defined as a design pattern that allows behavior to be added to an existing object dynamically. The idea is that the decoration itself isn't essential to the base functionality of an object otherwise it would be baked into the 'superclass' object itself.&lt;/p&gt;</description>
      <pubDate>Fri, 03 Aug 2012 18:49:50 UTC</pubDate>
      <guid>https://snipplr.com/view/66521/javascript-basic-decorator-pattern</guid>
    </item>
    <item>
      <title>(JavaScript) JavaScript Factory Pattern - timsommer</title>
      <link>https://snipplr.com/view/66520/javascript-factory-pattern</link>
      <description>&lt;p&gt;The Factory Pattern suggests defining an interface for creating an object where you allow the subclasses to decide which class to instantiate. This pattern handles the problem by defining a completely separate method for the creation of objects and which sub-classes are able to override so they can specify the â€˜typeâ€™ of factory product that will be created.&lt;/p&gt;</description>
      <pubDate>Fri, 03 Aug 2012 18:41:50 UTC</pubDate>
      <guid>https://snipplr.com/view/66520/javascript-factory-pattern</guid>
    </item>
    <item>
      <title>(JavaScript) JavaScript Facade - timsommer</title>
      <link>https://snipplr.com/view/66519/javascript-facade</link>
      <description>&lt;p&gt;When we put up a facade, we present an outward appearance to the world which may conceal a very different reality. This was the inspiration for the name behind the facade pattern. The facade pattern provides a convenient higher-level interface to a larger body of code, hiding its true underlying complexity. Think of it as simplifying the API being presented to other developers, something which almost always improves usability.&#13;
&#13;
This is an unoptimized code example, but here we're utilizing a facade to simplify an interface for listening to events cross-browser. We do this by creating a common method that can be used in oneâ€™s code which does the task of checking for the existence of features so that it can provide a safe and cross-browser compatible solution.&lt;/p&gt;</description>
      <pubDate>Fri, 03 Aug 2012 18:39:01 UTC</pubDate>
      <guid>https://snipplr.com/view/66519/javascript-facade</guid>
    </item>
    <item>
      <title>(JavaScript) JavaScript Command Pattern - timsommer</title>
      <link>https://snipplr.com/view/66443/javascript-command-pattern</link>
      <description>&lt;p&gt;The Command pattern aims to encapsulate method invocation, requests or operations&#13;
into a single object and gives you the ability to both parameterize and pass method calls&#13;
around that can be executed at your discretion. In addition, it enables you to decouple&#13;
objects invoking the action from the objects which implement them, giving you a&#13;
greater degree of overall flexibility in swapping out concrete 'classes'.&lt;/p&gt;</description>
      <pubDate>Tue, 31 Jul 2012 19:48:40 UTC</pubDate>
      <guid>https://snipplr.com/view/66443/javascript-command-pattern</guid>
    </item>
    <item>
      <title>(JavaScript) JavaScript Mediator Pattern - timsommer</title>
      <link>https://snipplr.com/view/66442/javascript-mediator-pattern</link>
      <description>&lt;p&gt;In software engineering, a mediator is a behavioral design pattern that allows us to&#13;
expose a unified interface through which the different parts of a system may communicate. If it appears a system may have too many direct relationships between modules (colleagues), it may be time to have a central point of control that modules communicate through instead. The Mediator promotes loose coupling by ensuring that instead of modules referring to each other explicitly, their interaction is handled through this central point.&#13;
&#13;
If you would prefer a real-world analogy, consider a typical airport traffic control system. A tower (mediator) handles what planes can take off and land because all communications (notifications being listened out for or broadcast) are done from the planes to the control tower, rather than from plane-to-plane. A centralized controller is key to the success of this system and that's really the role a mediator plays in software design.&lt;/p&gt;</description>
      <pubDate>Tue, 31 Jul 2012 19:40:55 UTC</pubDate>
      <guid>https://snipplr.com/view/66442/javascript-mediator-pattern</guid>
    </item>
    <item>
      <title>(JavaScript) Javascript Module Pattern - timsommer</title>
      <link>https://snipplr.com/view/66424/javascript-module-pattern</link>
      <description>&lt;p&gt;The module pattern was originally defined as a way to provide both private and public encapsulation for classes in conventional software engineering.&#13;
In JavaScript, the module pattern is used to further emulate the concept of classes in such a way that we're able to include both public/private methods and variables inside a single object, thus shielding particular parts from the global scope. What this results in is a reduction in the likelihood of your function names conflicting with other functions defined in additional scripts on the page.&lt;/p&gt;</description>
      <pubDate>Mon, 30 Jul 2012 22:30:45 UTC</pubDate>
      <guid>https://snipplr.com/view/66424/javascript-module-pattern</guid>
    </item>
    <item>
      <title>(JavaScript) Javascript Object Literal - timsommer</title>
      <link>https://snipplr.com/view/66423/javascript-object-literal</link>
      <description>&lt;p&gt;In object literal notation, an object is described as a set of comma-separated name/&#13;
value pairs enclosed in curly braces ({}). Names inside the object may be either strings or identifiers that are followed by a colon. There should be no comma used after the final name/value pair in the object as this may result in errors.&lt;/p&gt;</description>
      <pubDate>Mon, 30 Jul 2012 22:07:46 UTC</pubDate>
      <guid>https://snipplr.com/view/66423/javascript-object-literal</guid>
    </item>
    <item>
      <title>(JavaScript) Javascript Static Singleton Pattern - timsommer</title>
      <link>https://snipplr.com/view/66422/javascript-static-singleton-pattern</link>
      <description>&lt;p&gt;In conventional software engineering, the singleton pattern can be implemented by&#13;
creating a class with a method that creates a new instance of the class if one doesn't In conventional software engineering, the singleton pattern can be implemented by creating a class with a method that creates a new instance of the class if one doesn't&lt;/p&gt;</description>
      <pubDate>Mon, 30 Jul 2012 21:52:43 UTC</pubDate>
      <guid>https://snipplr.com/view/66422/javascript-static-singleton-pattern</guid>
    </item>
    <item>
      <title>(JavaScript) Javascript Singleton Pattern - timsommer</title>
      <link>https://snipplr.com/view/66421/javascript-singleton-pattern</link>
      <description>&lt;p&gt;In conventional software engineering, the singleton pattern can be implemented by&#13;
creating a class with a method that creates a new instance of the class if one doesn't exist. In the event of an instance already existing, it simply returns a reference to that object.&lt;/p&gt;</description>
      <pubDate>Mon, 30 Jul 2012 21:28:49 UTC</pubDate>
      <guid>https://snipplr.com/view/66421/javascript-singleton-pattern</guid>
    </item>
  </channel>
</rss>
