My Life As A Blog


leave a comment »

I was thinking about the Twitter client that I’ve been writing in Ruby.  Before embarking on the Ruby learning journey, I had written a Twitter client in C#.  I was considering comparing the two to see what I could learn about the differences and similarities.  The biggest difference isn’t really language related – it’s a design choice.  The C# client is asynchronous whereas the Ruby client is synchronous.  The C# client is asynchronous because I intended it to be used in a WPF app – although to test it from the command line, I wrote a synchronous wrapper (and used reflection in the command line program so that it can call any method on the synchronous wrapper with minimal code.)  The Ruby client is synchronous because it’s a learning exercise.

Writing an asynchronous client (at least in C#) makes your code more difficult to follow (well, it makes it more difficult for me at any rate.)  So, I started reconsidering if it would have been better to write a synchronous client  – largely because the code would be simpler.  This would mean that a WPF front-end would need to implement asynchronicity itself (assuming that it should be responsive.)  And given the fact that the web is, by its very nature asynchronous, this would mean asynchronous code calling a synchronous facade to an asynchronous service. Which sounds wrong.  So, I think that the client should be asynchronous.  But I’d like it to be simpler, too. Because of the target use, I decided an asynchronous client was the better design.  And this is the kind of decision that you have got to make one way or another.  You can’t hedge your bets and make it a bit asynchronous.  And if you change your mind, you’ve got some work to do.  I guess I should look at how you’d make the Ruby client asynchronous so I can get round to that comparison…


Written by remark

June 6, 2008 at 6:24 pm

Posted in .NET, Design, Development, Ruby

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: