﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>David Waite commented on Design patterns in the test of time: Prototype</title><description>The Java "Properties" class is a prototype I believe. You also have prototype based languages such as Java,  Lua and Io - in these there is no differentiation between a class and an object, as a 'class' is just a prototype which is used to create a new object.</description><link>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment6</link><guid>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment6</guid><pubDate>Tue, 20 Nov 2012 00:48:53 GMT</pubDate></item><item><title>Christian Schlichtherle commented on Design patterns in the test of time: Prototype</title><description>I think the Prototype pattern is generally useful with mutable objects of all kind, not only in multithreading environments. It basically enables you to make a protective copy when a mutable object is exchanged between a caller and a callee. The advantage of the prototype pattern is then that the protective copy is controlled by the original object, i.e. it defines the class of the object to create as well as all details (shallow clone, deep clone etc). You can't have so much control with other creational patterns.

On the cons side, implementing Cloneable creates an obligation for any sub class, so it should be used with care.</description><link>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment5</link><guid>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment5</guid><pubDate>Mon, 19 Nov 2012 12:26:45 GMT</pubDate></item><item><title>Rohit  commented on Design patterns in the test of time: Prototype</title><description>Prototype pattern can also be combined along with AbstractFactory to create objects. </description><link>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment4</link><guid>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment4</guid><pubDate>Wed, 31 Oct 2012 03:41:48 GMT</pubDate></item><item><title>Michael L Perry commented on Design patterns in the test of time: Prototype</title><description>I have found two uses for this pattern in production. Both have to do with retaining identity while specifying the object you want by example.

The first example is object recycling. In Update Controls, a dependency-tracking MVVM framework, you specify a dependent collection using Linq. When the results change -- for example one object is added to the collection -- the entire query is re-run. Update Controls will compare the results of the query to the objects already in the list, and recycle those that are equal. This lets it figure out what has been inserted, deleted, or reordered while still retaining the identity of the untouched objects. This keeps data-bound lists from scrolling to the top or losing their selection. The query results are used as a prototype.

The second example is persistence identity. In Correspondence, a collaboration framework, you call a method to persist an object. If that object already exists, then the existing one is returned. If not, it returns the parameter. By using the parameter as a prototype, this method retains the identity of an object in memory, relative to the object on disk.

Retaining identity is important. The prototype pattern accomplishes that.</description><link>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment3</link><guid>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment3</guid><pubDate>Tue, 30 Oct 2012 12:38:43 GMT</pubDate></item><item><title>David commented on Design patterns in the test of time: Prototype</title><description>How about in the implementation of move semantics for C++ 11?</description><link>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment2</link><guid>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment2</guid><pubDate>Tue, 30 Oct 2012 02:45:34 GMT</pubDate></item><item><title>mjanoska commented on Design patterns in the test of time: Prototype</title><description>Hi, 
 actually I found immutable objects (doing functional style in .Net) quite useful. As I see once you have immutable-s (like a horrible immutable App Viewmodel :-) ) cloning comes into the picture naturally (ok in case of simple regeneration of the immutable sub trees changed). Also to make say something about .Net support there's MemberwiseClone method and ICloneable interface.

 Cheers,
  Miklos</description><link>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment1</link><guid>http://ayende.com/159393/design-patterns-in-the-test-of-time-prototype#comment1</guid><pubDate>Mon, 29 Oct 2012 10:34:50 GMT</pubDate></item></channel></rss>