<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Oren Ellenbogen's Blog</title>
    <link>http://www.lnbogen.com/</link>
    <description>Striving for agile development</description>
    <language>en-us</language>
    <copyright>Oren Ellenbogen</copyright>
    <lastBuildDate>Mon, 04 Feb 2008 04:25:12 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.9.6264.0</generator>
    <managingEditor>oren.ellenbogen@gmail.com</managingEditor>
    <webMaster>oren.ellenbogen@gmail.com</webMaster>
    <item>
      <trackback:ping>http://www.lnbogen.com/Trackback.aspx?guid=b23f5c68-90b9-41a0-b18b-9069bea82c77</trackback:ping>
      <pingback:server>http://www.lnbogen.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lnbogen.com/PermaLink,guid,b23f5c68-90b9-41a0-b18b-9069bea82c77.aspx</pingback:target>
      <dc:creator>Oren Ellenbogen</dc:creator>
      <wfw:comment>http://www.lnbogen.com/CommentView,guid,b23f5c68-90b9-41a0-b18b-9069bea82c77.aspx</wfw:comment>
      <wfw:commentRss>http://www.lnbogen.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b23f5c68-90b9-41a0-b18b-9069bea82c77</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Having to parallelize almost every bit of code here at Delver, some common patterns
emerged while we wrote a lot of back-end code.<br />
I remember reading about a new framework from Microsoft Robotics Division called "Microsoft
CCR" (Concurrency and Coordination Runtime) a few months ago in the <a href="http://msdn.microsoft.com/msdnmag/issues/06/09/ConcurrentAffairs/default.aspx">"concurrent
affairs" column at the MSDN Magazine</a> but I didn't pay much attention to it
at the time. Two weeks ago, it jumped back to my mind so I revisit
the article and started diving a little deeper into it, thinking about what sort of
problems it can solve in my world and if it does, where could I use it to our benefit.
If you don't know anything about the CCR, there is great public content published
already like the CCR <a href="http://msdn2.microsoft.com/en-us/library/bb905447.aspx">User
Guide</a> but I'll try to give you a 2 minutes intro of the general architecture.
The way CCR is built is very much like the SOA world, using messages to communicate
between "services". The major components are the Dispatcher which is actually an array
of OS Threads, the DispatcherQueue which holds a queue of delegates to run
so the Dispatcher can "look" at the DispatcherQueue and when it has a free OS
Thread available, it pulls one delegate out of the queue and run it. So far - we've
got a classic ThreadPool. There are some differences but I'll let you read about it
in the User Guide. The third component, which is the most important one is Port.
Think about Port as a pipe that can receive messages (FIFO style - first in,
first out) and hold them until someone will know what to do with them. The last component
is the "manager", the Arbiter; Arbiter expose a set of methods that allows you
to listen to a given pipe and if some conditions are met on the messages the
pipe contains, we can take the message(s) and transform them into a runnable
delegate placed in the DispatcherQueue. 
</p>
        <p>
One of the goals for this library is the make sure you've got much less places to
go wrong, by exposing a set of common async patterns you can easily use to guarantee
clean(er) code that is easier to read. Think about sending messages from one pipe
to another, creating a flow-based code via messages rather than spaghetti
code with a lot of messy indentation. This is a very powerful architecture.<br />
Obviously, the entire CCR framework is thread-safe by design so no need to protect
the library. A simple example:
</p>
        <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          <p>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> (Dispatcher
dispatcher <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Dispatcher(5, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"my_dispatcher"</span>)) <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//5
OS threads</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> (DispatcherQueue
queue <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> DispatcherQueue(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"my_queue"</span>,
dispatcher))<br />
{<br />
    Port&lt;Uri&gt; urlsPort <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Port&lt;Uri&gt;();<br />
    <br />
    Arbiter.Activate(queue,<br />
        Arbiter.Receive(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>,
urlsPort, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">delegate</span>(Uri
uri) {<br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
some code(run async!): for example we can fetch the uri content(HTML) and persist
it to your Hard Disk..</span><br />
         })<br />
    );<br /><br />
    urlsPort.Post(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Uri(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://www.lnbogen.com"</span>));<br />
    urlsPort.Post(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Uri(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://www.delver.com"</span>));<br />
}
</p>
        </span>
        <p>
There is no need to create an array of Threads and some sort of Queue&lt;Uri&gt; in
order to pull the items. The "ThreadPool" is implemented as part of the CCR.<br />
So far no big deal right? well, it turns out that you can easily write common patterns
with much less complexity: almost no locks, less spaghetti code and much less
code in general. 
</p>
        <p>
One of the patterns we (all of us) use a lot is the "execute-and-wait-till-finish"
pattern where you've got a list of independent items you want to run in parallel,
but you want your main thread to wait for them to finish before continue. The simplest
way to achieve it is by creating an array of Thread, activating them with a delegate
and then call Join() on each one of the Threads. Let's define a few more requirements
for this pattern:
</p>
        <ol>
          <li>
We want to be able to know about all the errors that occurred during the execution. 
</li>
          <li>
We want to be able to set a timeout so each operation(inside a Thread) won't take
more than a sensible time. 
</li>
          <li>
We want to be able to know which items were timed out and when. 
</li>
          <li>
We want to be able to know which items were completed successfully. 
</li>
          <li>
BONUS: We want to avoid writing the obvious. </li>
        </ol>
        <p>
Well, in order to implement these requirements from scratch, we need to use an outer
timer with some sort of List (for example) so each thread will "register" to it when
it begins and "unregister" when it's done. The timer should be able to interrupt the
thread and be optimized to "wake up" as soon as possible (determined by the registered
threads and which thread needs to wake up first(next in line)). In addition, we need
some sort of List of exceptions to collect all the exceptions that occurred and make
sure we lock shared objects. We'll need to use Thread[] and some sort of Queue to
enqueue\dequeue items to\from it. A lot of code for a simple pattern.<br /><br />
With Microsoft CCR it's much easier. 
<br />
Assuming that we want to handle a list of strings:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">List&lt;<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>&gt;
messagesToWorkOn <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> List&lt;<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>&gt;();<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">for</span> (<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> i <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 0;
i &lt; 10; i++)<br />
   messagesToWorkOn.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"message
"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> i);</span>
        </p>
        <p>
Here is the final API I've implemented on top of the CCR:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> (SpawnAndWaitPattern&lt;<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>&gt; saw <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> SpawnAndWaitPattern&lt;<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>&gt;(5, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"mythreadspool"</span>))<br />
{<br />
   AggregatedResult&lt;<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>&gt;
result <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> saw.Execute(messagesToWorkOn, TimeSpan.FromMilliseconds(500),<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">                                             delegate</span>(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> msg)<br />
                                             {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">                                                if</span> (msg.Contains(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"1"</span>))<br />
                                                   Thread.Sleep(2000); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
simulate time-out</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">                                                else</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (msg.Contains(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"5"</span>))<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">                                                   throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ArgumentException(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"5
is a very bad value..."</span>); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
simulate exception</span><br />
   <br />
                                                Console.WriteLine(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"The
message: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> msg <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"
processed successfully."</span>);<br />
                                             });<br /><br />
   Console.WriteLine(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Done!"</span>);<br />
   Console.WriteLine(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Summarized
Report:\n completed results: "</span> <br />
      <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> result.SuccessfulItems.Count <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"\n
exceptions occurred: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> result.FaultedItems.Count <br />
      <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"\n
timed-out results: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> result.TimedoutItems.Count);<br />
}</span>
        </p>
        <p>
We've got 5 OS Threads, we're waiting for up to 0.5 second per item and we've got
a full result object, holding all the requirements from above.
</p>
        <p>
The code of SpawnAndWaitPattern class is quite neat and contains 0 locks (on
my behalf, the CCR manage its own locks). The CCR schedule the tasks for me; combining
it with thread-safe Port and we've got a very powerful yet simple framework
at our hands. I decided to attach the entire solution (with A LOT of
nice-green-comments) including the Ccr.Core.dll file so you could play with it:
</p>
        <p>
          <a href="http://www.lnbogen.com/content/binary/CcrPatterns.rar">CcrPatterns.rar (162.64
KB)</a>
        </p>
        <p>
Have fun.
</p>
        <img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=b23f5c68-90b9-41a0-b18b-9069bea82c77" />
      </body>
      <title>Microsoft CCR: clean way to write parallel code in .Net</title>
      <guid isPermaLink="false">http://www.lnbogen.com/PermaLink,guid,b23f5c68-90b9-41a0-b18b-9069bea82c77.aspx</guid>
      <link>http://www.lnbogen.com/MicrosoftCCRCleanWayToWriteParallelCodeInNet.aspx</link>
      <pubDate>Mon, 04 Feb 2008 04:25:12 GMT</pubDate>
      <description>&lt;p&gt;
Having to parallelize almost every bit of code here at Delver, some common patterns
emerged while we wrote a lot of back-end code.&lt;br&gt;
I remember reading about a new framework from Microsoft Robotics Division called "Microsoft
CCR" (Concurrency and Coordination Runtime)&amp;nbsp;a few months ago in the &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/09/ConcurrentAffairs/default.aspx"&gt;"concurrent
affairs" column&amp;nbsp;at the MSDN Magazine&lt;/a&gt; but I didn't pay much attention to it
at the time. Two weeks ago, it jumped back to my mind&amp;nbsp;so&amp;nbsp;I&amp;nbsp;revisit
the article and started diving a little deeper into it, thinking about what sort of
problems it can solve in my world and if it does, where could I use it&amp;nbsp;to our&amp;nbsp;benefit.
If you don't know anything about the CCR, there is great public content published
already&amp;nbsp;like the&amp;nbsp;CCR &lt;a href="http://msdn2.microsoft.com/en-us/library/bb905447.aspx"&gt;User
Guide&lt;/a&gt; but I'll try to give you a&amp;nbsp;2 minutes&amp;nbsp;intro of the general architecture.
The way CCR is built is very much like the SOA world, using messages to communicate
between "services". The major components are the Dispatcher which is actually an array
of OS Threads,&amp;nbsp;the&amp;nbsp;DispatcherQueue which holds a queue of delegates to run
so&amp;nbsp;the Dispatcher can "look" at the DispatcherQueue and when it has a free OS
Thread available, it pulls one delegate out of the queue and run it. So far - we've
got a classic ThreadPool. There are some differences but I'll let you read about it
in the User Guide. The third component, which is the most important one&amp;nbsp;is Port.
Think about Port as a pipe that can receive messages (FIFO style&amp;nbsp;- first in,
first out) and hold them until someone will know what to do with them. The last component
is the "manager", the&amp;nbsp;Arbiter; Arbiter expose a set of methods that allows you
to&amp;nbsp;listen to a given pipe and if some conditions are met on the messages the
pipe contains, we can take the message(s)&amp;nbsp;and transform them into a&amp;nbsp;runnable
delegate&amp;nbsp;placed in the DispatcherQueue. 
&lt;/p&gt;
&lt;p&gt;
One of the goals for this library is the make sure you've got much less places to
go wrong, by exposing a set of common async patterns&amp;nbsp;you can easily use to guarantee
clean(er) code that is easier to read. Think about sending messages from one pipe
to another, creating a flow-based code&amp;nbsp;via&amp;nbsp;messages&amp;nbsp;rather than spaghetti
code with a lot of messy indentation. This is a very powerful architecture.&lt;br&gt;
Obviously, the entire CCR framework is thread-safe by&amp;nbsp;design so no need to&amp;nbsp;protect
the library.&amp;nbsp;A simple example:
&lt;/p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt; 
&lt;p&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; (Dispatcher
dispatcher &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Dispatcher(5, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"my_dispatcher"&lt;/span&gt;)) &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//5
OS threads&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; (DispatcherQueue
queue &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; DispatcherQueue(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"my_queue"&lt;/span&gt;,
dispatcher))&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Port&amp;lt;Uri&amp;gt; urlsPort &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Port&amp;lt;Uri&amp;gt;();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Arbiter.Activate(queue,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Arbiter.Receive(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;,
urlsPort, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;delegate&lt;/span&gt;(Uri
uri) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
some code(run async!): for example we can&amp;nbsp;fetch the uri content(HTML) and persist
it to your Hard Disk..&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;})&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;urlsPort.Post(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Uri(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://www.lnbogen.com"&lt;/span&gt;));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;urlsPort.Post(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Uri(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://www.delver.com"&lt;/span&gt;));&lt;br&gt;
}
&lt;/span&gt;&gt;
&lt;p&gt;
There is no need to create an array of Threads and some sort of Queue&amp;lt;Uri&amp;gt; in
order to pull the items. The "ThreadPool" is implemented as part of the CCR.&lt;br&gt;
So far no big deal right? well, it turns out that you can easily write common patterns
with much less complexity: almost no locks, less spaghetti code and&amp;nbsp;much less
code in general. 
&lt;/p&gt;
&lt;p&gt;
One of the patterns we (all of us)&amp;nbsp;use a lot is the "execute-and-wait-till-finish"
pattern where you've got a list of independent items you want to run in parallel,
but you want your main thread to wait for them to finish before continue. The simplest
way to achieve it is by creating an array of Thread, activating them with a delegate
and then call Join() on each one of the Threads. Let's define a few more requirements
for this pattern:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
We want to be able to know about all the errors that occurred during the execution. 
&lt;li&gt;
We want to be able to set a timeout so each operation(inside a Thread) won't take
more than a sensible time. 
&lt;li&gt;
We want to be able to know which items were timed out and&amp;nbsp;when. 
&lt;li&gt;
We want to be able to know which&amp;nbsp;items were completed successfully. 
&lt;li&gt;
BONUS: We want to avoid writing the obvious.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Well, in order to implement these requirements from scratch, we need to use an outer
timer with some sort of List (for example) so each thread will "register" to it when
it begins and "unregister" when it's done. The timer should be able to interrupt the
thread and be optimized to "wake up" as soon as possible (determined by the registered
threads and which thread needs to wake up first(next in line)). In addition, we need
some sort of List of exceptions to collect all the exceptions that occurred and make
sure we lock shared objects. We'll need to use Thread[] and some sort of Queue to
enqueue\dequeue items to\from it.&amp;nbsp;A lot of code for a simple pattern.&lt;br&gt;
&lt;br&gt;
With Microsoft CCR it's much easier. 
&lt;br&gt;
Assuming that we want to handle a list of strings:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;List&amp;lt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;&amp;gt;
messagesToWorkOn &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;&amp;gt;();&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;for&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt; i &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; 0;
i &amp;lt; 10; i++)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;messagesToWorkOn.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"message
"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; i);&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Here is the final API I've implemented on top of the CCR:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; (SpawnAndWaitPattern&amp;lt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;&amp;gt;&amp;nbsp;saw &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; SpawnAndWaitPattern&amp;lt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;&amp;gt;(5, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"mythreadspool"&lt;/span&gt;))&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;AggregatedResult&amp;lt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;&amp;gt;
result &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; saw.Execute(messagesToWorkOn,&amp;nbsp;TimeSpan.FromMilliseconds(500),&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delegate&lt;/span&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; msg)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/span&gt; (msg.Contains(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"1"&lt;/span&gt;))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Thread.Sleep(2000); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
simulate time-out&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (msg.Contains(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"5"&lt;/span&gt;))&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; ArgumentException(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"5
is a very bad value..."&lt;/span&gt;); &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
simulate exception&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"The
message: "&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; msg &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"
processed successfully."&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Done!"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Summarized
Report:\n completed results: "&lt;/span&gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; result.SuccessfulItems.Count &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"\n
exceptions occurred: "&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; result.FaultedItems.Count&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"\n
timed-out results: "&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; result.TimedoutItems.Count);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
We've got 5 OS Threads, we're waiting for up to 0.5 second per item and we've got
a full result object, holding all the requirements from above.
&lt;/p&gt;
&lt;p&gt;
The code of SpawnAndWaitPattern class is quite neat and contains&amp;nbsp;0 locks (on
my behalf, the CCR manage its own locks). The CCR schedule the tasks for me; combining
it with thread-safe Port and we've got a&amp;nbsp;very&amp;nbsp;powerful yet simple framework
at&amp;nbsp;our hands.&amp;nbsp;I decided to attach the entire solution (with&amp;nbsp;A LOT&amp;nbsp;of
nice-green-comments) including the Ccr.Core.dll file so you could play with it:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.lnbogen.com/content/binary/CcrPatterns.rar"&gt;CcrPatterns.rar (162.64
KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Have fun.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=b23f5c68-90b9-41a0-b18b-9069bea82c77" /&gt;</description>
      <comments>http://www.lnbogen.com/CommentView,guid,b23f5c68-90b9-41a0-b18b-9069bea82c77.aspx</comments>
      <category>.NET;.Net/Multi-Threading;Microsoft CCR</category>
    </item>
    <item>
      <trackback:ping>http://www.lnbogen.com/Trackback.aspx?guid=3fade6f7-3cc6-4286-9974-a13eed804b62</trackback:ping>
      <pingback:server>http://www.lnbogen.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lnbogen.com/PermaLink,guid,3fade6f7-3cc6-4286-9974-a13eed804b62.aspx</pingback:target>
      <dc:creator>Oren Ellenbogen</dc:creator>
      <wfw:comment>http://www.lnbogen.com/CommentView,guid,3fade6f7-3cc6-4286-9974-a13eed804b62.aspx</wfw:comment>
      <wfw:commentRss>http://www.lnbogen.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3fade6f7-3cc6-4286-9974-a13eed804b62</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Alright alright, so I didn't post anything for... a decade or so. 
<br />
but I'm here (at the office that is) all day long, being a part of a great Team,
building the greatest\coolest piece of software I've ever dream of.<br /><br />
I promised myself that I'll be short this time so here it goes, Oren's 60 seconds
update:
</p>
        <ol>
          <li>
We've changed our name from Semingo to <strong>Delver</strong> (delver: <span showconjugation="on"><span style="WIDTH: 1pt"></span></span>(n)
deep thinker; one who investigates data). 
<br />
Hopefully (if God will hear his little buddy here), the phrase "To delve"
will catch up with the scary "Google-it". 
</li>
          <li>
We're going to show our product to the world at the <a href="http://www.demo.com/conferences/demo08/index.php">DEMO
conference</a> (28-30 January, yes, in 4 days!) in Palm Desert, CA.<br />
If you want to be one of our first beta users, please go to our site: <a href="http://www.delver.com">www.delver.com</a> and
register (we'll send you an email once we'll release our beta). 
</li>
          <li>
We're looking for super talented folks to join our amazing Team, interested?</li>
        </ol>
        <div>Short, to the point, no technical buzzzzz. I'm feeling violated.
</div>
        <div> 
</div>
        <div>
          <strong>update:</strong>
        </div>
        <div>here are a few links from interesting articles about us:
</div>
        <div> - <a href="http://www.delver.com/about.htm">http://www.delver.com/about.htm</a> (from
our home site)<br /></div>
        <div> - <span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Arial','sans-serif'"><a href="http://link.brightcove.com/services/link/bcpid1127798146/bclid1396518815/bctid1392526686">http://link.brightcove.com/services/link/bcpid1127798146/bclid1396518815/bctid1392526686</a> (6
minutes of live! demo\video, presented by our CEO at DEMO conference)</span></div>
        <div>
          <span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Arial','sans-serif'">
            <font face="Verdana" color="#003300">
              <span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Arial','sans-serif'"> <font face="Verdana" color="#003300">- </font><a href="http://www.somewhatfrank.com/2008/02/silicon-valley.html">http://www.somewhatfrank.com/2008/02/silicon-valley.html</a> (5
minutes demo\video from IsraelWebTour 2008)</span>
            </font>
          </span>
        </div>
        <div>
          <span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Arial','sans-serif'">
            <font face="Verdana" color="#003300"> - </font>
            <a href="http://www.readwriteweb.com/archives/delver_reinvents_search.php">http://www.readwriteweb.com/archives/delver_reinvents_search.php</a> (great summary
to understand our product)</span>
        </div>
        <div> - <a href="http://www.techcrunch.com/2008/01/28/delver-comes-out-of-stealth-with-a-new-twist-on-social-search/">http://www.techcrunch.com/2008/01/28/delver-comes-out-of-stealth-with-a-new-twist-on-social-search/</a></div>
        <div> - <a href="http://www.technologyreview.com/Infotech/20138/?a=f">http://www.technologyreview.com/Infotech/20138/?a=f</a><br />
 - <a href="http://www.webware.com/8301-1_109-9861049-2.html">http://www.webware.com/8301-1_109-9861049-2.html</a><br />
 - <a href="http://www.sdwys.com/2008/01/delver-delivers.html">http://www.sdwys.com/2008/01/delver-delivers.html</a><br />
 - <a href="http://mashable.com/2008/01/30/demo-08-roundup-2">http://mashable.com/2008/01/30/demo-08-roundup-2</a></div>
        <div> 
</div>
        <div> 
</div>
        <div>Next post - some cool multi-threading code and how to test it without wanting
to stick a nail in your eye (or someone's else eye). 
<br />
Now I'm feeling better...<br /></div>
        <img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=3fade6f7-3cc6-4286-9974-a13eed804b62" />
      </body>
      <title>Semingo, Delver, Demo, What a rush!</title>
      <guid isPermaLink="false">http://www.lnbogen.com/PermaLink,guid,3fade6f7-3cc6-4286-9974-a13eed804b62.aspx</guid>
      <link>http://www.lnbogen.com/SemingoDelverDemoWhatARush.aspx</link>
      <pubDate>Fri, 25 Jan 2008 10:46:58 GMT</pubDate>
      <description>&lt;p&gt;
Alright alright, so I didn't post anything for... a decade or so. 
&lt;br&gt;
but I'm here (at the office that is) all day long,&amp;nbsp;being a part of a great Team,
building the greatest\coolest piece of software I've ever dream of.&lt;br&gt;
&lt;br&gt;
I promised&amp;nbsp;myself that I'll be short this time so here it goes, Oren's 60 seconds
update:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
We've changed our name from Semingo&amp;nbsp;to &lt;strong&gt;Delver&lt;/strong&gt; (delver: &lt;span showconjugation="on"&gt;&lt;span style="WIDTH: 1pt"&gt;&lt;/span&gt;&lt;/span&gt;(n)
deep thinker; one who investigates data). 
&lt;br&gt;
Hopefully (if God will hear his little buddy here),&amp;nbsp;the phrase&amp;nbsp;"To delve"
will catch up&amp;nbsp;with the scary&amp;nbsp;"Google-it". 
&lt;li&gt;
We're going to show our&amp;nbsp;product to the world at the &lt;a href="http://www.demo.com/conferences/demo08/index.php"&gt;DEMO
conference&lt;/a&gt; (28-30 January, yes, in 4 days!) in Palm Desert, CA.&lt;br&gt;
If you want to be one of our first beta users, please go to our site: &lt;a href="http://www.delver.com"&gt;www.delver.com&lt;/a&gt; and
register (we'll send you an email once we'll release our beta). 
&lt;li&gt;
We're looking for super talented folks to join our amazing Team, interested?&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;Short, to the point, no technical buzzzzz. I'm feeling violated.
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;update:&lt;/strong&gt;
&lt;/div&gt;
&lt;div&gt;here are a few links from interesting articles about us:
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;- &lt;a href="http://www.delver.com/about.htm"&gt;http://www.delver.com/about.htm&lt;/a&gt; (from
our home site)&lt;br&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;- &lt;span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;a href="http://link.brightcove.com/services/link/bcpid1127798146/bclid1396518815/bctid1392526686"&gt;http://link.brightcove.com/services/link/bcpid1127798146/bclid1396518815/bctid1392526686&lt;/a&gt;&amp;nbsp;(6
minutes of live! demo\video,&amp;nbsp;presented by our CEO at&amp;nbsp;DEMO conference)&lt;/span&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;font face=Verdana color=#003300&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;&lt;font face=Verdana color=#003300&gt;-&amp;nbsp;&lt;/font&gt;&lt;a href="http://www.somewhatfrank.com/2008/02/silicon-valley.html"&gt;http://www.somewhatfrank.com/2008/02/silicon-valley.html&lt;/a&gt;&amp;nbsp;(5
minutes&amp;nbsp;demo\video from IsraelWebTour 2008)&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;font face=Verdana color=#003300&gt;&amp;nbsp;-&amp;nbsp;&lt;/font&gt;&lt;a href="http://www.readwriteweb.com/archives/delver_reinvents_search.php"&gt;http://www.readwriteweb.com/archives/delver_reinvents_search.php&lt;/a&gt;&amp;nbsp;(great&amp;nbsp;summary
to understand our product)&lt;/span&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;- &lt;a href="http://www.techcrunch.com/2008/01/28/delver-comes-out-of-stealth-with-a-new-twist-on-social-search/"&gt;http://www.techcrunch.com/2008/01/28/delver-comes-out-of-stealth-with-a-new-twist-on-social-search/&lt;/a&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;- &lt;a href="http://www.technologyreview.com/Infotech/20138/?a=f"&gt;http://www.technologyreview.com/Infotech/20138/?a=f&lt;/a&gt;
&lt;br&gt;
&amp;nbsp;- &lt;a href="http://www.webware.com/8301-1_109-9861049-2.html"&gt;http://www.webware.com/8301-1_109-9861049-2.html&lt;/a&gt;
&lt;br&gt;
&amp;nbsp;- &lt;a href="http://www.sdwys.com/2008/01/delver-delivers.html"&gt;http://www.sdwys.com/2008/01/delver-delivers.html&lt;/a&gt;
&lt;br&gt;
&amp;nbsp;- &lt;a href="http://mashable.com/2008/01/30/demo-08-roundup-2"&gt;http://mashable.com/2008/01/30/demo-08-roundup-2&lt;/a&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;Next post - some cool multi-threading code and how to test it without wanting
to&amp;nbsp;stick a nail in your eye (or someone's else eye). 
&lt;br&gt;
Now I'm feeling better...&lt;br&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=3fade6f7-3cc6-4286-9974-a13eed804b62" /&gt;</description>
      <comments>http://www.lnbogen.com/CommentView,guid,3fade6f7-3cc6-4286-9974-a13eed804b62.aspx</comments>
      <category>Life</category>
    </item>
    <item>
      <trackback:ping>http://www.lnbogen.com/Trackback.aspx?guid=bb39baf4-d670-4082-ace2-6748beeedb44</trackback:ping>
      <pingback:server>http://www.lnbogen.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lnbogen.com/PermaLink,guid,bb39baf4-d670-4082-ace2-6748beeedb44.aspx</pingback:target>
      <dc:creator>Oren Ellenbogen</dc:creator>
      <wfw:comment>http://www.lnbogen.com/CommentView,guid,bb39baf4-d670-4082-ace2-6748beeedb44.aspx</wfw:comment>
      <wfw:commentRss>http://www.lnbogen.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bb39baf4-d670-4082-ace2-6748beeedb44</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
Imagine that you're living with one hell of a crazy wife. Every day she's
giving you bunch of tasks. "Mow the grass", "water the plants", "take out the garbage",
"replace the light in the kitchen", "build a fence" etc. For every task you complete,
she goes bananas and create 10,000 more on the spot, all <b>related</b> to the task
itself ("build a fence" leads to "paint the fence", "put a nice sign on the fence",
"practice your wax-on, wax-off" … you get the drift). Reluctant to perform all of
these tasks but smart enough to know that you'll lose at least 50% of your property
(divorce are nasty), you start collecting these tasks (you write them on papers).
You take one paper (single task), perform it and return to your wife with a big-fat
smile of your face. She, in return, creates 10,000 new <b>related</b> tasks to the
one you've just completed, write them on paper and put it in a BIG box. Every once
in a while she's not waiting for you and adding "main" tasks to the box by herself.
After performing one task, you pick another one from the box (FIFO), without knowing
if it's a main task or not, you go to your way "eager" to perform that task as requested
(as if you have a choice). This goes on and on and on… 
</p>
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
The box is the tricky part here. Can one box hold billions of papers? hardly. So you
start collecting boxes and now it's getting harder as you need to add new boxes when
needed, find the "right" box to pull tasks from and making sure these boxes won't
break (maintenance) with time.
</p>
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
Here are a few assumptions you can take as is:
</p>
        <ol>
          <li>
            <span>
              <span>
                <span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">
                </span>
              </span>
            </span>
            <span dir="ltr">
            </span>Your
wife is looking for perfection but only in the "main" tasks which means that if you
were to build the fence, you have to do it perfectly so each mini task related to
it is crucial. 
</li>
          <li>
Your wife tends to forget things so you can assume that occasionally, she'll add new
"main" tasks that were already performed or exist in a different box.<span><span><span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"></span></span></span></li>
          <li>
            <span>
              <span>
                <span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">
                </span>
              </span>
            </span>
            <span dir="ltr">
            </span>You
can't throw away tasks "just because" as you don't know if a "mini task" will be thrown
by mistake (= your wife will be pissed off. 50% is gone.). 
</li>
          <li>
            <span>
              <span>
                <span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">
                </span>
              </span>
            </span>
            <span dir="ltr">
            </span>Be
cool - you won't perform the same task twice. This one is on me. 
</li>
          <li>
Drinking RedBull (or XL or whatever energy drink you're familiar with) 24-7-365 you
don't need to rest. You don't need to sleep. Think robot (funny combination, for 2007). 
</li>
        </ol>
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
How to store billions of tasks? 
</p>
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
I kinda like the "green feeling" of a forest. Oh right, we also need them in order
to breath (El Gor is more convincing than I. Thank God). Most importantly, it costs
a lot of money buying so many papers! And the boxes!<span>  You'll need </span>a
lot of green ones ($) - not trees but we can't "breath" without them as well). Oh
well… You're starting to build a "Boxing mechanism", hire a few guys to maintain them,
getting a VC to give you some extra $$$ and after a few months\years you got it cover!
</p>
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
What do you do if you don't have the extra $$$ or more important the extra time
to develop this kind of storage system?
</p>
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
How to store billions of tasks? You <b>don't</b>. You <b>can't</b>.  <span></span><br />
In most scenarios, when things seem too difficult to accomplish (with the given limits)
try a different angle: "If you don't like the answer, ask a different question". 
</p>
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
We know that each task creates a lot of new <b>related</b> tasks right? We also know
that keeping those new tasks is the tricky part (the BIG box problem) so what else
can be done? Let's change the question. "How do I make my wife happy?" seems like
a smarter question. If it's expensive to save those tasks why not doing these <b>related </b>tasks
on the spot instead of storing them in the box(es)? <span> </span>How is this
going to help us? Now we can throw away tasks because these tasks will be added later
on (assumption #2. Thank God your wife is not the robot). Assuming that we can save
about 1,000,000 papers in one big box – we're all set. If the box is full, we'll simply
throw away new "main" tasks, feeling good as we KNOW that we'll get to them later
on (again, assumption #2). Now all we need is one simple box with a limited amount
of papers. Less $$$ to waste and much simpler storage system to develop.
</p>
        <p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">
          <br />
Crap, it just hit me. I'm doing some cool sh$% at Semingo! Join <a href="http://www.pashabitz.com/PermaLink,guid,64f43e5b-9bb7-4a2e-bc89-0420c42b0866.aspx">us</a>!
</p>
        <img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=bb39baf4-d670-4082-ace2-6748beeedb44" />
      </body>
      <title>How to store billions of tasks?</title>
      <guid isPermaLink="false">http://www.lnbogen.com/PermaLink,guid,bb39baf4-d670-4082-ace2-6748beeedb44.aspx</guid>
      <link>http://www.lnbogen.com/HowToStoreBillionsOfTasks.aspx</link>
      <pubDate>Sat, 17 Nov 2007 22:54:31 GMT</pubDate>
      <description>&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
Imagine that you're living with&amp;nbsp;one hell of a&amp;nbsp;crazy wife. Every day she's
giving you bunch of tasks. "Mow the grass", "water the plants", "take out the garbage",
"replace the light in the kitchen", "build a fence" etc. For every task you complete,
she goes bananas and create 10,000 more on the spot, all &lt;b&gt;related&lt;/b&gt; to the task
itself ("build a fence" leads to "paint the fence", "put a nice sign on the fence",
"practice your wax-on, wax-off" … you get the drift). Reluctant to perform all of
these tasks but smart enough to know that you'll lose at least 50% of your property
(divorce are nasty), you start collecting these tasks (you write them on papers).
You take one paper (single task), perform it and return to your wife with a big-fat
smile of your face. She, in return, creates 10,000 new &lt;b&gt;related&lt;/b&gt; tasks to the
one you've just completed, write them on paper and put it in a BIG box. Every once
in a while she's not waiting for you and adding "main" tasks to the box by herself.
After performing one task, you pick another one from the box (FIFO), without knowing
if it's a main task or not, you go to your way "eager" to perform that task as requested
(as if you have a choice). This goes on and on and on… 
&lt;/p&gt;
&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
The box is the tricky part here. Can one box hold billions of papers? hardly. So you
start collecting boxes and now it's getting harder as you need to add new boxes&amp;nbsp;when
needed, find the "right" box to pull tasks from and making sure these boxes won't
break (maintenance) with time.
&lt;/p&gt;
&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
Here are a few assumptions you can take as is:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;span&gt;&lt;span&gt;&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=ltr&gt;&lt;/span&gt;Your
wife is looking for perfection but only in the "main" tasks which means that if you
were to build the fence, you have to do it perfectly so each mini task related to
it is crucial. 
&lt;li&gt;
Your wife tends to forget things so you can assume that occasionally, she'll add new
"main" tasks that were already performed or exist in a different box.&lt;span&gt;&lt;span&gt;&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span&gt;&lt;span&gt;&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=ltr&gt;&lt;/span&gt;You
can't throw away tasks "just because" as you don't know if a "mini task" will be thrown
by mistake (= your wife will be pissed off. 50% is gone.). 
&lt;li&gt;
&lt;span&gt;&lt;span&gt;&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=ltr&gt;&lt;/span&gt;Be
cool - you won't perform the same task twice. This one is on me. 
&lt;li&gt;
Drinking RedBull (or XL or whatever energy drink you're familiar with) 24-7-365 you
don't need to rest. You don't need to sleep. Think robot (funny combination, for 2007). 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
How to store billions of tasks? 
&lt;/p&gt;
&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
I kinda like the "green feeling" of a forest. Oh right, we also need them in order
to breath (El Gor is more convincing than I. Thank God). Most importantly, it costs
a lot of money buying&amp;nbsp;so many papers! And the boxes!&lt;span&gt;&amp;nbsp; You'll need &lt;/span&gt;a
lot of green ones ($) - not trees but we can't "breath" without them as well). Oh
well… You're starting to build a "Boxing mechanism", hire a few guys to maintain them,
getting a VC to give you some extra $$$ and after a few months\years you got it cover!
&lt;/p&gt;
&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
What do you do if you don't have the extra $$$ or more important&amp;nbsp;the extra time
to develop this kind of storage system?
&lt;/p&gt;
&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
How to store billions of tasks? You &lt;b&gt;don't&lt;/b&gt;. You &lt;b&gt;can't&lt;/b&gt;.&amp;nbsp; &lt;span&gt;&lt;/span&gt;
&lt;br&gt;
In most scenarios, when things seem too difficult to accomplish (with the given limits)
try a different angle: "If you don't like the answer, ask a different question". 
&lt;/p&gt;
&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
We know that each task creates a lot of new &lt;b&gt;related&lt;/b&gt; tasks right? We also know
that keeping those new tasks is the tricky part (the BIG box problem) so what else
can be done? Let's change the question. "How do I make my wife happy?" seems like
a smarter question. If it's expensive to save those tasks why not doing these &lt;b&gt;related &lt;/b&gt;tasks
on the spot instead of storing them in the box(es)? &lt;span&gt;&amp;nbsp;&lt;/span&gt;How is this
going to help us? Now we can throw away tasks because these tasks will be added later
on (assumption #2. Thank God your wife is not the robot). Assuming that we can save
about 1,000,000 papers in one big box – we're all set. If the box is full, we'll simply
throw away new "main" tasks, feeling good as we KNOW that we'll get to them later
on (again, assumption #2). Now all we need is one simple box with a limited amount
of papers. Less $$$ to waste and much simpler storage system to develop.
&lt;/p&gt;
&lt;p class=MsoNormal dir=ltr style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
&lt;br&gt;
Crap, it just hit me. I'm doing some cool sh$% at Semingo! Join &lt;a href="http://www.pashabitz.com/PermaLink,guid,64f43e5b-9bb7-4a2e-bc89-0420c42b0866.aspx"&gt;us&lt;/a&gt;!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=bb39baf4-d670-4082-ace2-6748beeedb44" /&gt;</description>
      <comments>http://www.lnbogen.com/CommentView,guid,bb39baf4-d670-4082-ace2-6748beeedb44.aspx</comments>
      <category>Design</category>
    </item>
    <item>
      <trackback:ping>http://www.lnbogen.com/Trackback.aspx?guid=fc104328-6299-4eb1-a203-84b686aa4c5b</trackback:ping>
      <pingback:server>http://www.lnbogen.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lnbogen.com/PermaLink,guid,fc104328-6299-4eb1-a203-84b686aa4c5b.aspx</pingback:target>
      <dc:creator>Oren Ellenbogen</dc:creator>
      <wfw:comment>http://www.lnbogen.com/CommentView,guid,fc104328-6299-4eb1-a203-84b686aa4c5b.aspx</wfw:comment>
      <wfw:commentRss>http://www.lnbogen.com/SyndicationService.asmx/GetEntryCommentsRss?guid=fc104328-6299-4eb1-a203-84b686aa4c5b</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Well this is mostly a good backup-post, but heck maybe a few other (<strong>VERY COOL</strong>)
geeks will find it interesting. 
<br />
Looking for some cool IDE colors\fonts, I came up with this:
</p>
        <p>
[ Regular mode ... ]
</p>
        <p>
          <img height="445" alt="ide_colors_regular.png" src="http://www.lnbogen.com/content/binary/ide_colors_regular.png" width="696" border="0" />
        </p>
        <p>
 
</p>
        <p>
[ Marking the for loop ... ]
</p>
        <p>
          <img height="449" alt="ide_colors_marking_text.png" src="http://www.lnbogen.com/content/binary/ide_colors_marking_text.png" width="662" border="0" />
        </p>
        <p>
 
</p>
        <p>
[ Output window ]
</p>
        <p>
          <img height="230" alt="ide_colors_output.png" src="http://www.lnbogen.com/content/binary/ide_colors_output.png" width="604" border="0" />
        </p>
        <p>
          <br />
I based my colors on ZenBurn.<br />
The font I'm using is Consolas.<br />
Read all about it in <a href="http://www.codinghorror.com/blog/">Jeff Atwood</a>'s <a href="http://www.codinghorror.com/blog/archives/000682.html">post</a>.
</p>
        <p>
You can download MY version here: <a href="http://www.lnbogen.com/content/binary/OrenEllenbogen_DarkSchema.rar">OrenEllenbogen_DarkSchema.rar
(58 KB)</a></p>
        <p>
          <strong>Note:</strong> if you're using ReSharper you'll have to disable the "Highlight
current line" option. 
</p>
        <img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=fc104328-6299-4eb1-a203-84b686aa4c5b" />
      </body>
      <title>Visual Studio .Net 2005 Colors</title>
      <guid isPermaLink="false">http://www.lnbogen.com/PermaLink,guid,fc104328-6299-4eb1-a203-84b686aa4c5b.aspx</guid>
      <link>http://www.lnbogen.com/VisualStudioNet2005Colors.aspx</link>
      <pubDate>Thu, 15 Nov 2007 10:34:24 GMT</pubDate>
      <description>&lt;p&gt;
Well this is mostly a good backup-post, but heck maybe a few other (&lt;strong&gt;VERY COOL&lt;/strong&gt;)
geeks will find it interesting. 
&lt;br&gt;
Looking for some cool IDE colors\fonts, I came up with this:
&lt;/p&gt;
&lt;p&gt;
[ Regular mode ...&amp;nbsp;]
&lt;/p&gt;
&lt;p&gt;
&lt;img height=445 alt=ide_colors_regular.png src="http://www.lnbogen.com/content/binary/ide_colors_regular.png" width=696 border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
[ Marking the for loop&amp;nbsp;... ]
&lt;/p&gt;
&lt;p&gt;
&lt;img height=449 alt=ide_colors_marking_text.png src="http://www.lnbogen.com/content/binary/ide_colors_marking_text.png" width=662 border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
[ Output window ]
&lt;/p&gt;
&lt;p&gt;
&lt;img height=230 alt=ide_colors_output.png src="http://www.lnbogen.com/content/binary/ide_colors_output.png" width=604 border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
I based my colors on ZenBurn.&lt;br&gt;
The font I'm using is Consolas.&lt;br&gt;
Read all about it in &lt;a href="http://www.codinghorror.com/blog/"&gt;Jeff Atwood&lt;/a&gt;'s&amp;nbsp;&lt;a href="http://www.codinghorror.com/blog/archives/000682.html"&gt;post&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
You can download MY version here: &lt;a href="http://www.lnbogen.com/content/binary/OrenEllenbogen_DarkSchema.rar"&gt;OrenEllenbogen_DarkSchema.rar
(58 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Note:&lt;/strong&gt; if you're using ReSharper you'll have to disable the "Highlight
current line" option.&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=fc104328-6299-4eb1-a203-84b686aa4c5b" /&gt;</description>
      <comments>http://www.lnbogen.com/CommentView,guid,fc104328-6299-4eb1-a203-84b686aa4c5b.aspx</comments>
      <category>.NET/Visual Studio .Net 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.lnbogen.com/Trackback.aspx?guid=8f4e3577-8db6-4890-a66d-7c124367dece</trackback:ping>
      <pingback:server>http://www.lnbogen.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lnbogen.com/PermaLink,guid,8f4e3577-8db6-4890-a66d-7c124367dece.aspx</pingback:target>
      <dc:creator>Oren Ellenbogen</dc:creator>
      <wfw:comment>http://www.lnbogen.com/CommentView,guid,8f4e3577-8db6-4890-a66d-7c124367dece.aspx</wfw:comment>
      <wfw:commentRss>http://www.lnbogen.com/SyndicationService.asmx/GetEntryCommentsRss?guid=8f4e3577-8db6-4890-a66d-7c124367dece</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
What is more important to you - having the brightest dude in the world in your
team, doing his magic with God-like authority or real "together-will-conquer-the-world"
Team work? Tricky question... 
</p>
        <p>
          <img height="126" alt="house_tv_show.jpg" src="http://www.lnbogen.com/content/binary/house_tv_show.jpg" width="388" border="0" />  
<br /><br />
For those of you who don't know the TV series "House", this is your wake up call!
Go see it. Now. Seriously.<br />
Well, if you don't have the time or you're just too damn eager to read my post, we'll,
"you're an idiot!", but that's your right so I'll give you a short summary: Dr. House,
played by the genius actor Hugh Laurie, is the go-to-guy for all the rare cases where
the rest of the doctors go bananas. With his extremely cynical point of view
and shameless wittiness, combined with a very bright, analytic and (yet) creative
thinking, he manage to solve all (we'll, almost) of these cases and still being a
complete jerk to his "teammates" during the show. Just a few pearls from <a href="http://en.wikiquote.org/wiki/House_(TV_series)">Wikiquote</a> so
you'll get the drift:
</p>
        <p>
          <strong>         Dr. Cuddy:</strong> You
don't prescribe medicine based on guesses. At least we don't since Tuskeegee and Mengele. <br /><strong>         Dr. House:</strong> You're
comparing me to a Nazi? [admiringly] Nice ... 
</p>
        <dd>
          <b>Lucille</b>: I'm not pregnant. 
<dd><b>Dr. House</b>: Sorry, you don't get to make that call unless you have a stethoscope.
Union rules.<br /><p>
If you ask me, I would pick House any day. Now, if any of you know such a man, let
him know that we're at Semingo are hiring; Till then, I guess that I would stick to
a strong Team and real commitment instead of software-Nazi. 
</p><p>
I'm lying. I don't think that following someone blindly is for me. I don't believe in
this kind of leadership. I grew up at the court, playing Basketball since I was
~9, there is nothing I love more than genuine Team spirit. Facing the fact that "white
man can't jump" quite early in my life, I realized that Michael Jordan can be rest
assured, I'm not going to steal his glory. Knowing that and still being the competitive
guy that I am, there is no other choice but to build a strong Team and having fun
together. It worked for me so far.
</p><p>
Shame though, It would have been funny working with someone like House; If only life
were a TV show...
</p></dd><img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=8f4e3577-8db6-4890-a66d-7c124367dece" /></dd>
      </body>
      <title>Can you build software like House ?</title>
      <guid isPermaLink="false">http://www.lnbogen.com/PermaLink,guid,8f4e3577-8db6-4890-a66d-7c124367dece.aspx</guid>
      <link>http://www.lnbogen.com/CanYouBuildSoftwareLikeHouse.aspx</link>
      <pubDate>Sat, 20 Oct 2007 03:16:42 GMT</pubDate>
      <description>&lt;p&gt;
What is more important to&amp;nbsp;you - having the brightest dude in the world in your
team, doing his magic with God-like authority or real "together-will-conquer-the-world"
Team work? Tricky question... 
&lt;/p&gt;
&lt;p&gt;
&lt;img height=126 alt=house_tv_show.jpg src="http://www.lnbogen.com/content/binary/house_tv_show.jpg" width=388 border=0&gt;&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
For those of you who don't know the TV series "House", this is your wake up call!
Go see it. Now. Seriously.&lt;br&gt;
Well, if you don't have the time or you're just too damn eager to read my post, we'll,
"you're an idiot!", but that's your right so I'll give you a short summary: Dr. House,
played by the genius actor Hugh Laurie, is the go-to-guy for all the rare cases where
the rest of the doctors&amp;nbsp;go bananas. With his extremely cynical point of view
and shameless wittiness, combined with a very bright, analytic and (yet) creative
thinking, he manage to solve all (we'll, almost) of these cases and still being a
complete jerk to his "teammates" during the show. Just a few pearls from &lt;a href="http://en.wikiquote.org/wiki/House_(TV_series)"&gt;Wikiquote&lt;/a&gt; so
you'll get the drift:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dr. Cuddy:&lt;/strong&gt; You
don't prescribe medicine based on guesses. At least we don't since Tuskeegee and Mengele.&amp;nbsp;&lt;br&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dr. House:&lt;/strong&gt; You're
comparing me to a Nazi? [admiringly] Nice ... 
&lt;/p&gt;
&lt;dd&gt;
&lt;b&gt;Lucille&lt;/b&gt;: I'm not pregnant. 
&lt;dd&gt;
&lt;b&gt;Dr. House&lt;/b&gt;: Sorry, you don't get to make that call unless you have a stethoscope.
Union rules.&lt;br&gt;
&lt;p&gt;
If you ask me, I would pick House any day. Now, if any of you know such a man, let
him know that we're at Semingo are hiring; Till then, I guess that I would stick to
a strong Team and real commitment instead of software-Nazi. 
&lt;/p&gt;
&lt;p&gt;
I'm lying. I don't think that following someone blindly is for me. I don't believe&amp;nbsp;in
this kind of leadership.&amp;nbsp;I grew up at the court, playing Basketball since I was
~9, there is nothing I love more than genuine Team spirit. Facing the fact that "white
man can't jump" quite early in my life, I realized that Michael Jordan can be rest
assured, I'm not going to steal his glory. Knowing that and still being the competitive
guy that I am, there is no other choice but to build a strong Team and having fun
together.&amp;nbsp;It worked for me so far.
&lt;/p&gt;
&lt;p&gt;
Shame though, It would have been funny working with someone like House; If only life
were a&amp;nbsp;TV show...
&lt;/p&gt;
&lt;/dd&gt;&lt;img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=8f4e3577-8db6-4890-a66d-7c124367dece" /&gt;</description>
      <comments>http://www.lnbogen.com/CommentView,guid,8f4e3577-8db6-4890-a66d-7c124367dece.aspx</comments>
      <category>Management</category>
    </item>
    <item>
      <trackback:ping>http://www.lnbogen.com/Trackback.aspx?guid=c8ddd489-b0cb-4c08-8e47-759cbe20f3c0</trackback:ping>
      <pingback:server>http://www.lnbogen.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lnbogen.com/PermaLink,guid,c8ddd489-b0cb-4c08-8e47-759cbe20f3c0.aspx</pingback:target>
      <dc:creator>Oren Ellenbogen</dc:creator>
      <wfw:comment>http://www.lnbogen.com/CommentView,guid,c8ddd489-b0cb-4c08-8e47-759cbe20f3c0.aspx</wfw:comment>
      <wfw:commentRss>http://www.lnbogen.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c8ddd489-b0cb-4c08-8e47-759cbe20f3c0</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blog.karmona.com/">Moti</a> and I have <a href="http://blog.karmona.com/index.php/2007/10/09/scrum-clan/">decided</a> to
form an invite-only <strong>Scrum Clan</strong>.<br />
We would like to tag <a title="Pasha Bitz" href="http://www.pashabitz.com/">Pasha
Bitz</a> (snapshot below) as the 3rd clan member.
</p>
        <p>
          <img height="195" alt="Pasha_Scrum_Lover.jpg" src="http://www.lnbogen.com/content/binary/Pasha_Scrum_Lover.jpg" width="241" border="0" />
        </p>
        <p>
Pasha, choose carefully, you can only tag <u>one</u> Scrum-Lover like yourself to
this distinguish clan ;)
</p>
        <p>
          <strong>
            <br />
p.s </strong>- If you want to be part of the Scrum Clan, please drop a comment
and you <em>*might*</em> get an invitation...
</p>
        <p>
          <strong>
            <font size="4">                                                     </font>
          </strong>
        </p>
        <p>
          <strong>
            <font size="4">                                 </font>
            <font size="5">Scrum
Rules !</font>
          </strong>
        </p>
        <img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=c8ddd489-b0cb-4c08-8e47-759cbe20f3c0" />
      </body>
      <title>Scrum Clan</title>
      <guid isPermaLink="false">http://www.lnbogen.com/PermaLink,guid,c8ddd489-b0cb-4c08-8e47-759cbe20f3c0.aspx</guid>
      <link>http://www.lnbogen.com/ScrumClan.aspx</link>
      <pubDate>Tue, 09 Oct 2007 22:47:34 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://blog.karmona.com/"&gt;Moti&lt;/a&gt;&amp;nbsp;and I have &lt;a href="http://blog.karmona.com/index.php/2007/10/09/scrum-clan/"&gt;decided&lt;/a&gt; to
form an invite-only &lt;strong&gt;Scrum Clan&lt;/strong&gt;.&lt;br&gt;
We would like to tag &lt;a title="Pasha Bitz" href="http://www.pashabitz.com/"&gt;Pasha
Bitz&lt;/a&gt; (snapshot below) as the 3rd clan member.
&lt;/p&gt;
&lt;p&gt;
&lt;img height=195 alt=Pasha_Scrum_Lover.jpg src="http://www.lnbogen.com/content/binary/Pasha_Scrum_Lover.jpg" width=241 border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Pasha, choose carefully, you can only tag &lt;u&gt;one&lt;/u&gt; Scrum-Lover like yourself to
this distinguish clan ;)
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;
&lt;br&gt;
p.s &lt;/strong&gt;- If you want to be part of the Scrum Clan, please drop&amp;nbsp;a comment
and you &lt;em&gt;*might*&lt;/em&gt; get an invitation...
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=4&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=4&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font size=5&gt;Scrum
Rules !&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=c8ddd489-b0cb-4c08-8e47-759cbe20f3c0" /&gt;</description>
      <comments>http://www.lnbogen.com/CommentView,guid,c8ddd489-b0cb-4c08-8e47-759cbe20f3c0.aspx</comments>
      <category>Scrum</category>
    </item>
    <item>
      <trackback:ping>http://www.lnbogen.com/Trackback.aspx?guid=32565423-11a0-4e72-aef4-8667884ef8d7</trackback:ping>
      <pingback:server>http://www.lnbogen.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lnbogen.com/PermaLink,guid,32565423-11a0-4e72-aef4-8667884ef8d7.aspx</pingback:target>
      <dc:creator>Oren Ellenbogen</dc:creator>
      <wfw:comment>http://www.lnbogen.com/CommentView,guid,32565423-11a0-4e72-aef4-8667884ef8d7.aspx</wfw:comment>
      <wfw:commentRss>http://www.lnbogen.com/SyndicationService.asmx/GetEntryCommentsRss?guid=32565423-11a0-4e72-aef4-8667884ef8d7</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Let me start with an out-loud recap of this post: Agile is not something you can put
on a bread nor is it "a certain path to success". 
</p>
        <p>
          <strong>It's about STATE OF MIND.</strong>
        </p>
        <p>
If I had to describe the meaning of "Agile" to a new teammate I would say: Agile is
a constant thinking about how we, AS A TEAM, can produce working features to our users
with high quality within a short time-frame. 
<br /><br />
Don't worry:<br />
It's really OK to provide only a subset of feature(s) in one sprint. 
<br />
It's really OK to leave SOME designing\architecture issues for later on as long as
the high-level architecture is good enough (=you're comfortable with it) to answer
the big questions.<br />
It's really OK to implement only two REALLY-DONE-HIGH-QUALITY features in one sprint
over four semi-working-not-demoable features.<br /></p>
        <p>
The key here though is not really the practices, it's about the big bullets(again,
state of mind):
</p>
        <p>
1). Produce value for your customers and adjust\adopt early. 
<br />
2). Build a Team (self leadership).
</p>
        <p>
These ideas are hard to implement and require special kind of people. Putting
the Team in front of yourself is not a very job-secure attitude.  The ability
to help your teammates, shift tasks, taking ownership, critisize yourself and your
teammates and getting better, produce high quality design, tests and code - all of
it - requires versatile people with unique state of mind (and unique abilities,
of course). It's worth it. When things glue, it's a real magic; Things start to get
going by the Team, improvements and features starting to come from the developers\QA\Graphic
Designer, adjustments are made on a regular basis, changes are welcome and productivity
is <strong>celebrated</strong>. 
</p>
        <p>
You can feel something is going right. 
<br />
That's Agile.
</p>
        <img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=32565423-11a0-4e72-aef4-8667884ef8d7" />
      </body>
      <title>No, THAT is not Agile</title>
      <guid isPermaLink="false">http://www.lnbogen.com/PermaLink,guid,32565423-11a0-4e72-aef4-8667884ef8d7.aspx</guid>
      <link>http://www.lnbogen.com/NoTHATIsNotAgile.aspx</link>
      <pubDate>Mon, 10 Sep 2007 18:21:03 GMT</pubDate>
      <description>&lt;p&gt;
Let me start with an out-loud recap of this post: Agile is not something you can put
on a bread nor is it "a certain path to success". 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;It's about STATE OF MIND.&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
If I had to describe the meaning of "Agile" to a new teammate I would say: Agile is
a constant thinking about how we, AS A TEAM, can produce working features to our users
with high quality within a short time-frame. 
&lt;br&gt;
&lt;br&gt;
Don't worry:&lt;br&gt;
It's really OK to provide only a subset of feature(s) in one sprint. 
&lt;br&gt;
It's really OK to leave SOME designing\architecture issues for later on as long as
the high-level architecture is good enough (=you're comfortable with it) to answer
the big questions.&lt;br&gt;
It's really OK to implement only two REALLY-DONE-HIGH-QUALITY features in one sprint
over four semi-working-not-demoable features.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
The key here though is not really the practices, it's about the big bullets(again,
state of mind):
&lt;/p&gt;
&lt;p&gt;
1). Produce value for your customers and adjust\adopt early. 
&lt;br&gt;
2). Build a Team (self leadership).
&lt;/p&gt;
&lt;p&gt;
These ideas are hard to&amp;nbsp;implement and require special&amp;nbsp;kind of people. Putting
the Team in front of yourself is not a very job-secure attitude.&amp;nbsp; The ability
to help your teammates, shift tasks, taking ownership, critisize yourself and your
teammates and getting better, produce high quality design, tests and code - all of
it&amp;nbsp;- requires versatile people with unique state of mind (and unique abilities,
of course). It's worth it. When things glue, it's a real magic; Things start to get
going by the Team, improvements and features starting to come from the developers\QA\Graphic
Designer, adjustments are made on a regular basis, changes are welcome and productivity
is &lt;strong&gt;celebrated&lt;/strong&gt;. 
&lt;/p&gt;
&lt;p&gt;
You can feel something is going right. 
&lt;br&gt;
That's Agile.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=32565423-11a0-4e72-aef4-8667884ef8d7" /&gt;</description>
      <comments>http://www.lnbogen.com/CommentView,guid,32565423-11a0-4e72-aef4-8667884ef8d7.aspx</comments>
      <category>Agile</category>
    </item>
    <item>
      <trackback:ping>http://www.lnbogen.com/Trackback.aspx?guid=76dbf68b-8dd6-4ebb-ab89-11a7b93f58d5</trackback:ping>
      <pingback:server>http://www.lnbogen.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lnbogen.com/PermaLink,guid,76dbf68b-8dd6-4ebb-ab89-11a7b93f58d5.aspx</pingback:target>
      <dc:creator>Oren Ellenbogen</dc:creator>
      <wfw:comment>http://www.lnbogen.com/CommentView,guid,76dbf68b-8dd6-4ebb-ab89-11a7b93f58d5.aspx</wfw:comment>
      <wfw:commentRss>http://www.lnbogen.com/SyndicationService.asmx/GetEntryCommentsRss?guid=76dbf68b-8dd6-4ebb-ab89-11a7b93f58d5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The way WCF proxies are designed is to live until shi* happens. 
<br /><br />
Let's assume that we have a CalcualtorService with one method named Divide(int a,
int b). Sasha, a cool programmer-dude, trying to produce some usefull software
writes:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span> MyCalcualtorForm
: Form {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"><br />
   private</span> CalculatorProxy _calc <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> CalculatorProxy();<br /><br />
   Calc_Click(...) {<br />
      _calc.Divide(firstNumber, secondNumber);<br />
   }<br />
}<br /></span>
        </p>
        <p>
What is the first error you can think of that could happen? Yep, DivideByZeroException.<br />
Once the proxy gets an exception, it enters into a "Faulted" state which makes the
proxy unusable(=you cannot use it again). 
<br />
The quickest solution is to work "by the book" and create a new instance each and
every time we need to call the service:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Calc_Click(...)
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   using</span> (CalculatorProxy
calc <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> CalculatorProxy())<br />
      calc.Divide(firstNumber, secondNumber);<br />
}<br /></span>
        </p>
        <p>
But what's bad in this solution?
</p>
        <ol>
          <li>
Performance - you pay (not a lot but neither little) for each creation of the proxy.
Sure, it will probably not be your bottleneck, but heck, why is it useful? Most of
the time the proxy will not throw an exception and yet we need to create it every
time just to avoid the faulted state scenario.  
</li>
          <li>
Design - If we declare this exception BY CONTRACT, I would expect that the proxy will
still be usable afterwards. Do we really want to return Enum\int\string as status
instead of throwing exception just because of poor design? 
</li>
          <li>
TDD - you know that I'm in love with it. Now imagine Dependency Injection. Component
A recieve ICalculatorProxy and use it to... calculate something. Working "by the book"
is no good as we want to recieve an instance of the proxy from the outside in
order to mock it. Right, so we inject a proxy from the outside (got to love
Windsor) and life is pretty sweeet. Darn! Wait! one poor (even by design) exception
and our proxy goes dead. Very un-TDDish of Microsoft.</li>
        </ol>
        <p>
I had to come with a solution as no one will take TDD away from me. I present
to you ProtectedProxy: this little IL-code-at-the-end-of-the-day will able
you to recover from faulted state by creating a new proxy on each exception thus making
your proxy... useable (couldn't think about a better word to describe it). Think about
a situation where your proxy is trying to call the service but the service is down; In
Semingo, we decided that we want to keep trying until the service is up. Via ProtectedProxy,
you can determine how many times do you want to recover and when you should finally
kill the proxy. Oh yea, ProtectedProxy uses Windsor in order to create new proxies
if needed and logging messages to log4net. Good stuff.
</p>
        <p>
In the example above, all Sasha had to do was to:<br />
1). Initialize the _calc field by:<br />
        ProtectedProxy&lt;ICalculatorProxy&gt;
_calc = new ProtectedProxy&lt;ICalculatorProxy&gt;(new CalculatorProxy());<br />
2). call _calc via:<br />
        _calc.Instance.Divide(firstNumber, secondNumber);<br /><br />
But enough said, code please:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
Written by Oren Ellenbogen (07.08.07) - trying to protect our proxies so they could
recover from:</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
(A) The service is not up yet, but we want to try again later.</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
(B) The service throws (ANY) exception, we still want our proxy to function (bubble
the exception, but still keep on working).</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
Microsoft intended to use a NEW proxy per call, but for TDD this is not ideal as we
would like to inject proxies from outside as mocks</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
in order to simulate multiple scenarios. </span>
            <br />
            <br />
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">#region</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span>
            <br />
            <br />
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Reflection;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.ServiceModel;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> Castle.Core.Resource;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> Castle.Windsor;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> Castle.Windsor.Configuration.Interpreters;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> log4net; 
<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">#endregion</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">namespace</span> Semingo.Services.Proxies.Helpers<br />
{<br /></span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   <br />
   <font color="#0000ff">public</font><font color="#0000ff">interface</font> IProxy
: ICommunicationObject { <br />
      <font color="#0000ff">bool</font> Ping();<br />
   }</span>
        </p>
        <div>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   </span>
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">///
&lt;summary&gt;</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
Protect proxy from entering Faulted state by re-creating the proxy via Windsor Container
on Faulted.</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
IMPORTANT: that even if a fatal exception is raised by the service (for example: the
service is not up yet), the proxy will be raised again. <br />
   /// Use it wisely (TIP: you CAN determine the number of 'recovery'
attempts).</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
&lt;/summary&gt;</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
&lt;typeparam name="I"&gt;The proxy interface to protect&lt;/typeparam&gt;</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
&lt;remarks&gt;</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
The way WCF works is that ANY exception on the service will cause the proxy to enter
"faulted" state which means you can not use it anymore.</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
Imagine a service of CalculatorService that expose the method float Divide(int a,
int b). Sending b=0 will raise an exception in the service</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
and the proxy will get into faulted state. This is not ideal as the proxy itself should
be used again.</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   ///
&lt;/remarks&gt;</span>
            <br />
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> ProtectedProxy&lt;I&gt;
: IDisposable<br />
      where I : <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"><font color="#000000">IProxy</font></span><br />
   {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">readonly</span> ILog
_logger <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span> I
_instance;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">readonly</span> IWindsorContainer
_container;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> _faultedCounter <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 0;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">bool</span> _disposed <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">false</span>;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> AlertableNumberOfFaultedTimes <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 10; <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span> ProtectedProxy(I
instance)<br />
         : <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>(CreateXmlBasedWindsorContainer(),
instance)<br />
      {   <br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span> ProtectedProxy(IWindsorContainer
container, I instance)<br />
      {<br />
         _container <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> container;<br />
         ShieldInstance(instance);<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///
&lt;summary&gt;</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///
Returns the number of faults this proxy had so far</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///
&lt;/summary&gt;</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> NumberOfFaults<br />
      {<br />
         get { <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span> _faultedCounter;
}<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span> I
Instance<br />
      {<br />
         get<br />
         {<br />
            ThrowIfInstanceAlreadyDisposed(); <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            if</span> (_instance.State
== CommunicationState.Faulted || _instance.State == CommunicationState.Closed || _instance.State
== CommunicationState.Closing)<br />
               {<br />
                  _logger.Warn(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Notice:
The proxy state is invalid ("</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> communicationObj.State <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">").
The Faulted event should have been raised and handle this state - this need to be
checked."</span>);<br />
                  HandleFaultedInstance();<br />
               }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            return</span> _instance;<br />
         }<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Close()<br />
      {<br />
         Dispose();<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> ThrowIfInstanceAlreadyDisposed()<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         if</span> (_disposed)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ObjectDisposedException(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"The
protected proxy for the type: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> _instance.GetType().FullName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"
was closed. Cannot return a live instance of this type."</span>);<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> ShieldInstance(I
instance)<br />
      {<br />
         _instance <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> instance; <br />
         _instance.Faulted += <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">delegate</span> {
HandleFaultedInstance(); };<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> HandleFaultedInstance()<br />
      {<br />
         ThrowIfInstanceAlreadyDisposed(); <br /><br />
         _faultedCounter++; <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         if</span> (_faultedCounter
&gt;= AlertableNumberOfFaultedTimes)<br />
            _logger.Warn(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"ALERT!
The proxy for the type "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> _instance.GetType().FullName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"
got faulted for the "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> _faultedCounter <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"
time. Recreating the proxy but we must verify if this is valid."</span>);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         else</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (_logger.IsDebugEnabled)<br />
            _logger.Debug(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Proxy
for type "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> _instance.GetType().FullName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"
got faulted (current state: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> ((ICommunicationObject)_instance).State <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">")
- recreating the proxy. Number of faulted instances so far: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> _faultedCounter <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"."</span>); <br /><br />
         ProxyHelper.CloseProxy(_instance); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
close current proxy</span><br />
         ShieldInstance(_container.Resolve&lt;I&gt;()); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
re-create the proxy, faulted proxies are no good for further use.</span><br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span> IWindsorContainer
CreateXmlBasedWindsorContainer()<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         try</span><br />
         {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            return</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> WindsorContainer(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> XmlInterpreter(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ConfigResource(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"castle"</span>)));<br />
         }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         catch</span> (Exception
err)<br />
         {<br />
            _logger.Warn(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Unable
to create xml based windsor container, using empty one."</span>, err);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            return</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> WindsorContainer(); <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
for testing (the proxy will be mocked anyway).</span><br />
         }<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      #region</span> IDisposable
Members <br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///&lt;summary&gt;</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///Performs
application-defined tasks associated with freeing, releasing, or resetting unmanaged
resources.</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///&lt;/summary&gt;</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Dispose()<br />
      {<br />
         Dispose(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>);<br />
         GC.SuppressFinalize(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>);<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      protected</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">virtual</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Dispose(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">bool</span> disposing)<br />
      {<br />
         _logger.Info(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Attempting
to dispose the protected proxy for the type: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> _instance.GetType().FullName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">",
disposed already? "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> _disposed); <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         if</span> (_disposed) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span>; <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         if</span> (disposing)<br />
         {<br />
            ProxyHelper.CloseProxy(_instance);<br />
         } <br /><br />
         _disposed <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>;<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      #endregion</span><br />
   }<br /><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> ProxyHelper<br />
   {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">readonly</span> ILog
_logger <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> CloseProxy(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> proxy)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         if</span> (proxy
== <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span>; <br />
         CloseProxy(proxy <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span> ICommunicationObject);<br />
      } <br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///
&lt;summary&gt;</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///
Close the proxy in a safe manner (will not throw exception)</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///
&lt;/summary&gt;</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      ///
&lt;param name="proxy"&gt;The proxy to close&lt;/param&gt;</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> CloseProxy(ICommunicationObject
proxy)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         if</span> (proxy
== <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span>; <br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         try</span><br />
         {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            if</span> (proxy.State
== CommunicationState.Closing || proxy.State == CommunicationState.Closed || proxy.State
== CommunicationState.Faulted)<br />
               proxy.Abort();<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            else</span><br />
               proxy.Close();<br />
         }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         catch</span> (CommunicationException)<br />
         {<br />
            proxy.Abort();<br />
         }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         catch</span> (TimeoutException)<br />
         {<br />
            proxy.Abort();<br />
         }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         catch</span> (Exception
err)<br />
         {<br />
            _logger.Error(err);<br />
            proxy.Abort();<br />
         }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         finally</span><br />
         {<br />
            proxy <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>;<br />
      }<br /></span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   }<br />
}</span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <br />
          </span>
        </div>
        <p>
Hours of joy...
</p>
        <p>
Almost forgot, on the next post - "How to TDD WCF code" - stay tuned...
</p>
        <img width="0" height="0" src="http://www.lnbogen.com/aggbug.ashx?id=76dbf68b-8dd6-4ebb-ab89-11a7b93f58d5" />
      </body>
      <title>Making WCF Proxy useable</title>
      <guid isPermaLink="false">http://www.lnbogen.com/PermaLink,guid,76dbf68b-8dd6-4ebb-ab89-11a7b93f58d5.aspx</guid>
      <link>http://www.lnbogen.com/MakingWCFProxyUseable.aspx</link>
      <pubDate>Wed, 05 Sep 2007 22:23:59 GMT</pubDate>
      <description>&lt;p&gt;
The way WCF proxies are designed is to live until shi* happens. 
&lt;br&gt;
&lt;br&gt;
Let's assume that we have a CalcualtorService with one method named Divide(int a,
int b). Sasha, a&amp;nbsp;cool programmer-dude, trying to&amp;nbsp;produce some usefull software
writes:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; MyCalcualtorForm
: Form {&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt; CalculatorProxy _calc &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; CalculatorProxy();&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Calc_Click(...) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_calc.Divide(firstNumber, secondNumber);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
What is the&amp;nbsp;first error you can think of that could happen? Yep, DivideByZeroException.&lt;br&gt;
Once the proxy gets an exception, it enters into a "Faulted" state which makes the
proxy unusable(=you cannot use it again). 
&lt;br&gt;
The quickest solution is to work "by the book" and create a new instance each and
every time we need to call the service:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Calc_Click(...)
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/span&gt; (CalculatorProxy
calc &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; CalculatorProxy())&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;calc.Divide(firstNumber, secondNumber);&lt;br&gt;
}&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
But what's bad in this solution?
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Performance - you pay (not a lot but neither little) for each creation of the proxy.
Sure, it will probably not be your bottleneck, but heck, why is it useful? Most of
the time the proxy will not throw an exception and yet we need to create it every
time just to avoid&amp;nbsp;the faulted state scenario.&amp;nbsp; 
&lt;li&gt;
Design - If we declare this exception BY CONTRACT, I would expect that the proxy will
still be usable afterwards. Do we really want to return Enum\int\string as status
instead of throwing exception just because of&amp;nbsp;poor design? 
&lt;li&gt;
TDD - you know that I'm in love with it. Now imagine Dependency Injection. Component
A recieve ICalculatorProxy and use it to... calculate something. Working "by the book"
is no good&amp;nbsp;as we want to recieve an instance of the proxy from the outside in
order to&amp;nbsp;mock it. Right,&amp;nbsp;so we inject a proxy from the outside (got to love
Windsor) and life is pretty sweeet. Darn! Wait!&amp;nbsp;one poor (even by design) exception
and our proxy goes dead. Very un-TDDish of Microsoft.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
I had to come with&amp;nbsp;a solution&amp;nbsp;as no one will take TDD away from me. I present
to you ProtectedProxy: this&amp;nbsp;little IL-code-at-the-end-of-the-day&amp;nbsp;will able
you to recover from faulted state by creating a new proxy on each exception thus making
your proxy... useable (couldn't think about a better word to describe it). Think about
a situation where your proxy is trying to call the service but the service is down;&amp;nbsp;In
Semingo, we decided that we want to keep trying until the service is up. Via ProtectedProxy,
you can determine how many times do you want to recover and when you should finally
kill the proxy.&amp;nbsp;Oh yea, ProtectedProxy uses Windsor in order to create new proxies
if needed and logging messages to log4net. Good stuff.
&lt;/p&gt;
&lt;p&gt;
In the example above, all Sasha had to&amp;nbsp;do was to:&lt;br&gt;
1).&amp;nbsp;Initialize the _calc field by:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ProtectedProxy&amp;lt;ICalculatorProxy&amp;gt;
_calc = new ProtectedProxy&amp;lt;ICalculatorProxy&amp;gt;(new CalculatorProxy());&lt;br&gt;
2). call _calc via:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _calc.Instance.Divide(firstNumber, secondNumber);&lt;br&gt;
&lt;br&gt;
But enough said, code please:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
Written by Oren Ellenbogen (07.08.07) - trying to protect our proxies so they could
recover from:&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
(A) The service is not up yet, but we want to try again later.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
(B) The service throws (ANY) exception, we still want our proxy to function (bubble
the exception, but still keep on working).&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
Microsoft intended to use a NEW proxy per call, but for TDD this is not ideal as we
would like to inject proxies from outside as mocks&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
in order to simulate multiple scenarios. &lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;#region&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Reflection;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.ServiceModel;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; Castle.Core.Resource;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; Castle.Windsor;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; Castle.Windsor.Configuration.Interpreters;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; log4net; 
&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;#endregion&lt;/span&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;namespace&lt;/span&gt; Semingo.Services.Proxies.Helpers&lt;br&gt;
{&lt;br&gt;
&lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;public&lt;/font&gt; &lt;font color=#0000ff&gt;interface&lt;/font&gt; IProxy
: ICommunicationObject {&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;bool&lt;/font&gt; Ping();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;
&lt;/p&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
Protect proxy from entering Faulted state by re-creating the proxy via Windsor Container
on Faulted.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
IMPORTANT: that even if a fatal exception is raised by the service (for example: the
service is not up yet), the proxy will be raised again.&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;/// Use it wisely (TIP: you CAN determine the number of 'recovery'
attempts).&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
&amp;lt;typeparam name="I"&amp;gt;The proxy interface to protect&amp;lt;/typeparam&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
&amp;lt;remarks&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
The way WCF works is that ANY exception on the service will cause the proxy to enter
"faulted" state which means you can not use it anymore.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
Imagine a service of CalculatorService that expose the method float Divide(int a,
int b). Sending b=0 will raise an exception in the service&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
and the proxy will get into faulted state. This is not ideal as the proxy itself should
be used again.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;///
&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; ProtectedProxy&amp;lt;I&amp;gt;
: IDisposable&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;where I :&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font color=#000000&gt;IProxy&lt;/font&gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;readonly&lt;/span&gt; ILog
_logger &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);&amp;nbsp;&lt;br&gt;
&lt;br&gt;