﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on RavenDB implementation frustrations</title><description>Patrick,
The networking stack difference means that I have slight different lower level stuff in the SL codebase, requiring me to create an abstraction on top of that, but that abstraction is useful when we are at that level, I have to have a different way to process for async in SL and in standard code.
The main problem with the ifdef approach isn't for that, the problem is that three different ways of invoking the same logic (sync, async, lazy).</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment9</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment9</guid><pubDate>Thu, 11 Aug 2011 10:45:49 GMT</pubDate></item><item><title>Patrick Huizinga commented on RavenDB implementation frustrations</title><description>What prevents you from reusing the Silverlight code in the full .Net stack? Besides the few lines for like transactions that could be #if-ed?

However, I feel your pain. I implemented a cross platform duplex channel (that actually stays open), does retries and reuses its underlying channels. It took me about a thousand lines (including comments and white lines) and I had to get my hands dirty with IRequestChannel and custom Messages. Oh and I the server side was another few hundred lines (partly shared with the client side).

Btw, in the Silverlight code I see a ContinueWith call. Is that from an actual Task, or is that custom code that just resembles a Task?</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment8</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment8</guid><pubDate>Thu, 11 Aug 2011 08:15:53 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB implementation frustrations</title><description>Andrey,
Try to write an API like that, especially an Async one. It isn't pleasant.
And it doesn't really work when you have exceptional cases or need to do retries</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment7</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment7</guid><pubDate>Wed, 10 Aug 2011 23:19:27 GMT</pubDate></item><item><title>Andrey Shchekin commented on RavenDB implementation frustrations</title><description>I might be completely wrong in my understanding of the underlying problem, but I would have solved this thing this way:
public IValue&lt;JsonDocument&gt; Get(string serverUrl, string key, Func&lt;Request, IValue&lt;string&gt;&gt; getResponseString)

where interface IValue is a monad-like thing:
public interface IValue&lt;T&gt; {
    IValue&lt;TResult&gt; Apply&lt;TResult&gt;(Func&lt;T, TResult&gt; function);
    ...
}

Then you have two implementations of IValue, Just&lt;T&gt; where Apply runs immediately and Furture&lt;T&gt;, where Apply uses ContinueWith.</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment6</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment6</guid><pubDate>Wed, 10 Aug 2011 22:01:30 GMT</pubDate></item><item><title>Uncle Lob commented on RavenDB implementation frustrations</title><description>Wow that is one ugly code. Have you read Clean Code book sir?</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment5</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment5</guid><pubDate>Wed, 10 Aug 2011 08:10:25 GMT</pubDate></item><item><title>Andres commented on RavenDB implementation frustrations</title><description>The construction of the JsonDocument should be in a method, there are a lot of common code inside these brackets. The URL generation could be in another method too, and maybe some of the exception management</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment4</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment4</guid><pubDate>Tue, 09 Aug 2011 13:51:03 GMT</pubDate></item><item><title>tobi commented on RavenDB implementation frustrations</title><description>One thing that occured to me very late is that very very similar algorithms sometimes have special cases in only a few places but you just cannot either pull out the similarities or generalize using parameters/delegates. Sometimes, it is just not possible.

Therefore I try to keep the different versions in sync as much as possible and keep as much of the structure the same as I can. Basically I just give up. Once you realize that this case actually occurs (and it is not just you being stupid) you take it much more easily.
</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment3</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment3</guid><pubDate>Tue, 09 Aug 2011 11:33:57 GMT</pubDate></item><item><title>tarwn commented on RavenDB implementation frustrations</title><description>Any reason not to extract the central portion of the sync method (the outer try/catch) and use it as a method call for the sync and asyc operation? Other than the extra try/catch I'm not seeing much difference between those two (I'm also on my first cup of coffee). If you refactored that into a method then you could easily use it from both the sync and async operation.
The silverlight one looks fairly different due to the error catching, but it looks like you have already started extracting the web exception handling into a different function? It seems there might be some potential to use a common webexception handle function.
Anyways, as I said earlier I'm on my first cup of coffee and it's possible that something like this has already occurred to you and isn't possible (sometimes things look possible w/ code samples that aren't when you take the whole codebase into account).</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment2</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment2</guid><pubDate>Tue, 09 Aug 2011 10:52:52 GMT</pubDate></item><item><title>Simon Bartlett commented on RavenDB implementation frustrations</title><description>You should make your code samples scrollable - they disappear off the right side of the page behind the main navigation.</description><link>http://ayende.com/59394/ravendb-implementation-frustrations#comment1</link><guid>http://ayende.com/59394/ravendb-implementation-frustrations#comment1</guid><pubDate>Tue, 09 Aug 2011 09:26:03 GMT</pubDate></item></channel></rss>