﻿<?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>Stan commented on Design patterns in the test of time: Decorator</title><description>Stan: I'm not sure how dynamic proxy or using PostSharp is different. OK, you don't write decorator by hand but still something is decorating object.
Runtime behaviour is same.</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment9</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment9</guid><pubDate>Thu, 08 Nov 2012 18:03:05 GMT</pubDate></item><item><title>Frisian commented on Design patterns in the test of time: Decorator</title><description>@Ayende: That's exactly one of the differences between Proxy and Decorator: In a decorator behaviour is added with the API of the underlying object in mind. So if that API changes, the decorator has to be modified as well. 
In a proxy on the other hand, you have a one-size-fits-all approach, i.e. adding the same functionality to every method of the underlying object. Consequently, proxies can be constructed dynamically in many languages, usually employing reflection.</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment8</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment8</guid><pubDate>Thu, 08 Nov 2012 08:25:13 GMT</pubDate></item><item><title>Stan commented on Design patterns in the test of time: Decorator</title><description>Decorator can be usefull in c++ with its multiple inheritance. For c# it's mostly useless for reasons Ayende have provided. Something like dynamic proxy or post sharping may be better used for injecting behaviour.</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment7</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment7</guid><pubDate>Thu, 08 Nov 2012 06:38:47 GMT</pubDate></item><item><title>Ayende Rahien commented on Design patterns in the test of time: Decorator</title><description>Euphoric,
That is certainly one aspect of that.
The other aspect is that when you add a new method to the decorated object, you now need to go and add that to all the decorating, etc.
I don't like this sort of behavior.</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment6</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment6</guid><pubDate>Wed, 07 Nov 2012 23:49:40 GMT</pubDate></item><item><title>Chris commented on Design patterns in the test of time: Decorator</title><description>Decorator plays especially nicely with DI containers and cross cutting concerns.  StructureMap's Interceptor API just screams decorator at you.
</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment5</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment5</guid><pubDate>Wed, 07 Nov 2012 21:29:37 GMT</pubDate></item><item><title>Jacob T commented on Design patterns in the test of time: Decorator</title><description>ditto re the CachingDecorator. What is wrong with it?</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment4</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment4</guid><pubDate>Wed, 07 Nov 2012 19:58:30 GMT</pubDate></item><item><title>Euphoric commented on Design patterns in the test of time: Decorator</title><description>@Michal : I think one reasons are side effects. This decorator would need to know if underlying data/decorated object changed and invalidate itself. This introduces hard to debug problems when cache decorator returns invalid data.
I think this is what having one input/output channel means.</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment3</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment3</guid><pubDate>Wed, 07 Nov 2012 19:58:29 GMT</pubDate></item><item><title>Michal Lašák commented on Design patterns in the test of time: Decorator</title><description>Could you please specify more, why we should avoid CachingDecorator? Actually I thought that it was very elegant solution to do caching and work with DI container.</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment2</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment2</guid><pubDate>Wed, 07 Nov 2012 16:02:10 GMT</pubDate></item><item><title>Jason Young commented on Design patterns in the test of time: Decorator</title><description>Is that code example from Head First Design Patterns?  I found that book's examples to not always be very motivating--that is, they demonstrated use of a pattern, but not necessarily a case where you'd actually want to use that pattern.</description><link>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment1</link><guid>http://ayende.com/159553/design-patterns-in-the-test-of-time-decorator#comment1</guid><pubDate>Wed, 07 Nov 2012 13:03:26 GMT</pubDate></item></channel></rss>