﻿<?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>Ayende Rahien commented on Design patterns in the test of time: Adapter</title><description>Mike,
There are actually two of them here, System.Web, System.Web.Abstractions and System.Web.MVC.
They couldn't change System.Web, and require the extra abstraction to allow to swap things.</description><link>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment6</link><guid>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment6</guid><pubDate>Fri, 02 Nov 2012 13:09:49 GMT</pubDate></item><item><title>Rafal commented on Design patterns in the test of time: Adapter</title><description>'Adapter' in the context of this post is just another name for wrapper. But imho to be called an 'adapter' the module should include a nontrivial mapping/translation logic - otherwise it's just a wrapper. And I disagree that wrappers should be used only when you don't control the code - sometimes you introduce them deliberately to reduce dependencies on external libraries by abstracting them. Example: logging library wrappers.</description><link>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment5</link><guid>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment5</guid><pubDate>Fri, 02 Nov 2012 08:29:34 GMT</pubDate></item><item><title>Mike McG commented on Design patterns in the test of time: Adapter</title><description>I'm not sure that I follow your argument here. You say that it should be used only to "integrate two or more external systems/libraries" but then say that HttpContextWrapper is a good example of it. HttpContextWrapper involves only a single external library (System.Web being external to System.Web.Mvc). These two statements contradict.

I've found this pattern critically useful whenever I have a high-level interface-based design, and want to leverage third-party libraries to implement the interfaces at a later time. Those external libraries by definition do not implement my internal interfaces, requiring me to write an adapter. Thinner adapters are better, but sometimes some non-trivial shimming must be implemented to make the adaptation workable. Either way, the external dependency is fully abstracted by the interface, and the adapter is what makes this all work. It's perhaps a matter of semantics, then, that the adapter does or does not provide abstraction.

In my opinion, especially in an era of FLOSS and web service explosion, leveraging external resources without sacrificing design is critical. The adapter pattern does this and therefore is as important as ever.</description><link>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment4</link><guid>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment4</guid><pubDate>Fri, 02 Nov 2012 08:08:26 GMT</pubDate></item><item><title>Jeff commented on Design patterns in the test of time: Adapter</title><description>Spot on...very useful patter if used in the correct context and not as a means of abstraction.</description><link>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment3</link><guid>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment3</guid><pubDate>Thu, 01 Nov 2012 16:27:48 GMT</pubDate></item><item><title>Ayende Rahien commented on Design patterns in the test of time: Adapter</title><description>Rafal,
It depends on whatever you control the code or not.</description><link>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment2</link><guid>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment2</guid><pubDate>Thu, 01 Nov 2012 10:32:54 GMT</pubDate></item><item><title>Rafal commented on Design patterns in the test of time: Adapter</title><description>I don't quite get your recommendations. You say some people use wrappers to abstract things and it's not what wrappers are meant for. But at the same time you give an example (HttpContextBase) of abstracting things through a wrapper class.</description><link>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment1</link><guid>http://ayende.com/159457/design-patterns-in-the-test-of-time-adapter#comment1</guid><pubDate>Thu, 01 Nov 2012 10:30:49 GMT</pubDate></item></channel></rss>