<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/javascript/tags/designpattern</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Thu, 20 Jun 2013 12:32:22 GMT</pubDate>
<item>
<title>(JavaScript) JavaScript Factory Pattern - timsommer</title>
<link>http://snipplr.com/view/66520/javascript-factory-pattern/</link>
<description><![CDATA[ <p>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.</p> ]]></description>
<pubDate>Fri, 03 Aug 2012 18:41:50 GMT</pubDate>
<guid>http://snipplr.com/view/66520/javascript-factory-pattern/</guid>
</item>
<item>
<title>(JavaScript) JavaScript Facade - timsommer</title>
<link>http://snipplr.com/view/66519/javascript-facade/</link>
<description><![CDATA[ <p>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.

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.</p> ]]></description>
<pubDate>Fri, 03 Aug 2012 18:39:01 GMT</pubDate>
<guid>http://snipplr.com/view/66519/javascript-facade/</guid>
</item>
<item>
<title>(JavaScript) JavaScript Command Pattern - timsommer</title>
<link>http://snipplr.com/view/66443/javascript-command-pattern/</link>
<description><![CDATA[ <p>The Command pattern aims to encapsulate method invocation, requests or operations
into a single object and gives you the ability to both parameterize and pass method calls
around that can be executed at your discretion. In addition, it enables you to decouple
objects invoking the action from the objects which implement them, giving you a
greater degree of overall flexibility in swapping out concrete 'classes'.</p> ]]></description>
<pubDate>Tue, 31 Jul 2012 19:48:40 GMT</pubDate>
<guid>http://snipplr.com/view/66443/javascript-command-pattern/</guid>
</item>
<item>
<title>(JavaScript) JavaScript Mediator Pattern - timsommer</title>
<link>http://snipplr.com/view/66442/javascript-mediator-pattern/</link>
<description><![CDATA[ <p>In software engineering, a mediator is a behavioral design pattern that allows us to
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.

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.</p> ]]></description>
<pubDate>Tue, 31 Jul 2012 19:40:55 GMT</pubDate>
<guid>http://snipplr.com/view/66442/javascript-mediator-pattern/</guid>
</item>
<item>
<title>(JavaScript) JavaScript Observer Pattern - timsommer</title>
<link>http://snipplr.com/view/66441/javascript-observer-pattern/</link>
<description><![CDATA[ <p>The Observer pattern is more popularly known these days as the Publish/Subscribe
pattern. It is a design pattern which allows an object (known as a subscriber) to watch another object (the publisher), where we provide a means for the subscriber and pub-lisher form a listen and broadcast relationship.

Popular JavaScript libraries such as dojo, jQuery (custom events) and YUI
already have utilities that can assist in easily implementing a Pub/Sub system with very little effort.</p> ]]></description>
<pubDate>Tue, 31 Jul 2012 19:11:13 GMT</pubDate>
<guid>http://snipplr.com/view/66441/javascript-observer-pattern/</guid>
</item>
<item>
<title>(JavaScript) Observer-Pattern in JavaScript - magna</title>
<link>http://snipplr.com/view/60698/observerpattern-in-javascript/</link>
<description><![CDATA[ <p>Could be improved by passing an event instead of a simple payload.</p> ]]></description>
<pubDate>Thu, 10 Nov 2011 21:41:19 GMT</pubDate>
<guid>http://snipplr.com/view/60698/observerpattern-in-javascript/</guid>
</item>
<item>
<title>(JavaScript) Aria in Widgets - brettb</title>
<link>http://snipplr.com/view/43217/aria-in-widgets/</link>
<description><![CDATA[ <p>Reusable function to create an aria alert for any widget and provide a better abstraction to setting its innerHTML.</p> ]]></description>
<pubDate>Fri, 29 Oct 2010 06:55:03 GMT</pubDate>
<guid>http://snipplr.com/view/43217/aria-in-widgets/</guid>
</item>
</channel>
</rss>