﻿<?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>Alex Simkin commented on Challenge: Modifying execution approaches</title><description>@Chris Wright

Not only this pattern got a name, it even got two names. Strategy and State patterns are two names for the same programming construct.</description><link>http://ayende.com/59393/challenge-modifying-execution-approaches#comment6</link><guid>http://ayende.com/59393/challenge-modifying-execution-approaches#comment6</guid><pubDate>Wed, 03 Aug 2011 11:26:17 GMT</pubDate></item><item><title>Chris Wright commented on Challenge: Modifying execution approaches</title><description>I'm surprised that the strategy pattern is worthy of a name. It's just method object + inheritance, no?</description><link>http://ayende.com/59393/challenge-modifying-execution-approaches#comment5</link><guid>http://ayende.com/59393/challenge-modifying-execution-approaches#comment5</guid><pubDate>Tue, 02 Aug 2011 23:34:28 GMT</pubDate></item><item><title>Duarte Nunes commented on Challenge: Modifying execution approaches</title><description>Off the top of my head, I would have something like

    IEnumerator LoadInternal&lt;T, M&gt;(string id, string[] includes, 
                                                         Func&lt;string, string[], M&gt; cmd,
                                                         Func&lt;M, MultiLoadResult&gt; unwrapper);

And pump the enumerator either sync or asynchronously. I guess you can sophisticate this a bit to be able to return a typed IEnumerator. (This smells kind of monady).</description><link>http://ayende.com/59393/challenge-modifying-execution-approaches#comment4</link><guid>http://ayende.com/59393/challenge-modifying-execution-approaches#comment4</guid><pubDate>Tue, 02 Aug 2011 16:03:01 GMT</pubDate></item><item><title>Scooletz commented on Challenge: Modifying execution approaches</title><description>Use lazy enumerable, like in the result of Future&lt;T&gt; from NHibernate. Address the internal choice with a strategy, passing the rest of the code, which must be executed as a some-kind-of continuation. During iteration IEnumerable&lt;T&gt; different actions can occur (the enumerable is produced via strategy, for instance AsynchGetStrategy : IGetStrategy). What do you think about it?</description><link>http://ayende.com/59393/challenge-modifying-execution-approaches#comment3</link><guid>http://ayende.com/59393/challenge-modifying-execution-approaches#comment3</guid><pubDate>Tue, 02 Aug 2011 11:26:25 GMT</pubDate></item><item><title>tobi commented on Challenge: Modifying execution approaches</title><description>Besides using a delegate as Dave recommended, I would consider having just an async version and using a blocking wait around the call in the synchronous case. That makes for 99% code sharing.</description><link>http://ayende.com/59393/challenge-modifying-execution-approaches#comment2</link><guid>http://ayende.com/59393/challenge-modifying-execution-approaches#comment2</guid><pubDate>Tue, 02 Aug 2011 09:49:50 GMT</pubDate></item><item><title>Dave commented on Challenge: Modifying execution approaches</title><description>Without having seen the rest of the code, the description of the problem screems 'strategy pattern' to me. If I assume that LoadInternal is used by all three implementations, settings a delegate (which is called on the marked line) could do the job.

Whether this is the correct solutions depends ofcourse on more than just the problem you've try to solve. </description><link>http://ayende.com/59393/challenge-modifying-execution-approaches#comment1</link><guid>http://ayende.com/59393/challenge-modifying-execution-approaches#comment1</guid><pubDate>Tue, 02 Aug 2011 09:22:15 GMT</pubDate></item></channel></rss>