<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The joys of new territory in API design</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx</link><description>I remember back in the day when we added a first-class notion of properties to the CLR\C#. Up to that time we just had methods and constructors (events came later still). We really didn&amp;#8217;t know how to use these things (even though they had existed</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: The joys of new territory in API design</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx#155897</link><pubDate>Tue, 15 Jun 2004 10:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:155897</guid><dc:creator>Mike Scott</dc:creator><description>&amp;gt;&amp;gt; Up to that time we just had methods and constructors (events came later still).  We really didn’t know how to use these things (even though they had existed for *years* in other systems) &amp;lt;&amp;lt;&lt;br&gt;&lt;br&gt;That's odd, Brad. Indeed they had existed for *years* in other systems, such as that one from Borland that Anders and Chuck Jazdzewski wrote. Are you saying he forgot how to use properties and events when he went to Microsoft? :o))</description></item><item><title>re: The joys of new territory in API design</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx#156108</link><pubDate>Tue, 15 Jun 2004 15:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:156108</guid><dc:creator>Brad Abrams [MSFT]</dc:creator><description>It was not a lack of experience at Microsoft as much as it was a lack of experience on my team... Believe me, Anders had a cow when he saw it.. ;-)</description></item><item><title>Bizarre Indexer Syntax in C#</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx#156423</link><pubDate>Tue, 15 Jun 2004 22:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:156423</guid><dc:creator>IanG on Tap</dc:creator><description /></item><item><title>re: The joys of new territory in API design</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx#156586</link><pubDate>Tue, 15 Jun 2004 23:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:156586</guid><dc:creator>Keith Hill</dc:creator><description>Good call.  I have observed the after effects of people using the &amp;quot;new toy&amp;quot; everywhere that it could be shoe-horned in.  Later on, folks wake up from the euphoria and it's hang-over time - and it's ugly.  :-)</description></item><item><title>re: The joys of new territory in API design</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx#156685</link><pubDate>Wed, 16 Jun 2004 01:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:156685</guid><dc:creator>JD</dc:creator><description>I had meant to comment on that thread....&lt;br&gt;&lt;br&gt;Following your own principles is best: write the 3 lines of code the user of the API would have to use:&lt;br&gt;&lt;br&gt;With overloading:&lt;br&gt;Foo(reader);&lt;br&gt;&lt;br&gt;With generics:&lt;br&gt;Foo&amp;lt;XmlReader&amp;gt;(reader)&lt;br&gt;&lt;br&gt;&lt;br&gt;Having the user write out an ugly generic method invocation is clearly *not* a good tradeoff for reducing the number of overloads by half.</description></item><item><title>re: The joys of new territory in API design</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx#156866</link><pubDate>Wed, 16 Jun 2004 08:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:156866</guid><dc:creator>Peter</dc:creator><description>Hi!&lt;br&gt;&lt;br&gt;A question about something else.&lt;br&gt;&lt;br&gt;&amp;quot;Platform vs Library Versioning in Longhorn/Orcas&amp;quot;&lt;br&gt;&lt;a target="_new" href="http://wesnerm.blogs.com/net_undocumented/2004/06/platform_vs_lib.html"&gt;http://wesnerm.blogs.com/net_undocumented/2004/06/platform_vs_lib.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;Looks like serious change... Any comments, Brad?&lt;br&gt;</description></item><item><title>re: The joys of new territory in API design</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx#157031</link><pubDate>Wed, 16 Jun 2004 13:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:157031</guid><dc:creator>Brad Abrams</dc:creator><description>Good question Peter  -- and what an appropriate thread to ask it on.  Although the concepts behind the P\L split are years old we are still very nascent in our understanding of how to apply these in the system.   We are still actively working out the guidance for WinFX, but I strongly believe we should error on the side of simplicity of model… We have a long road ahead of us in Orcas\Longhorn, so I wouldn’t put too much faith in any plans like this one for a while… &lt;br&gt;&lt;br&gt;That said, I would love to hear customers reactions to the plan... </description></item><item><title>another question on generics</title><link>http://blogs.msdn.com/brada/archive/2004/06/14/155717.aspx#162973</link><pubDate>Tue, 22 Jun 2004 22:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162973</guid><dc:creator>Andrey Shchekin</dc:creator><description>While studying BCL with Reflector, I found an interesting interface, IServiceProvider, that has one method taking Type parameter:&lt;br&gt;object GetService(Type serviceType);&lt;br&gt;&lt;br&gt;It is obvious that we must perform one additional cast on the result returned by it.&lt;br&gt;&lt;br&gt;Is there any way to express this idea in generics ? My question is purely theoretical - I do not ask if it will be done some day. Let's suppose that I made a similar  interface:&lt;br&gt;public interface IMyServiceProvider&lt;br&gt;{&lt;br&gt;    T GetService&amp;lt;T&amp;gt;();&lt;br&gt;}&lt;br&gt;&lt;br&gt;Can I provide a class implementing this interface ? It must implement this method so that it will return null for unsupported types and object of type T for supported.&lt;br&gt;So there are two possible solutions - to make a switch on T in the method body (something like switching on gettype(T).FullName), or provide some generic overloads for GetService based on T.&lt;br&gt;&lt;br&gt;So the question is simple - what is the easiest and the most appropriate way to perform something based on the generic argument. &lt;br&gt;I suppose that there is a very simple answer, but I have some problems with understanding it. &lt;br&gt;&lt;br&gt;Sorry for my bad English.</description></item></channel></rss>