The Artima Developer Community
Sponsored Link

.NET Buzz Forum
A Tale of Two Types

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jonathan Crossland

Posts: 630
Nickname: jonathanc
Registered: Feb, 2004

Jonathan Crossland is a software architect for Lucid Ocean Ltd
A Tale of Two Types Posted: Feb 12, 2009 9:40 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Jonathan Crossland.
Original Post: A Tale of Two Types
Feed Title: Jonathan Crossland Weblog
Feed URL: http://www.jonathancrossland.com/syndication.axd
Feed Description: Design, Frameworks, Patterns and Idioms
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Jonathan Crossland
Latest Posts From Jonathan Crossland Weblog

Advertisement

Something to think about

I would really like to see Design Patterns merge and disappear into our frameworks and runtimes.

For example, A Singleton could easily become a keyword and managed by the runtime.

But specifically here are two scenarios for merging a wrapper, or form of adaptor pattern.

Mapping Types
If you reference an Assembly (A) from your application that contains a Type that you want to use. Then you discover another Assembly (B), which references (A) you can. However, if the Assembly (B) and the Assembly (A) both reference the same Type from let's say a webservice, the code generated, thinks of these as two different Types. Although they come from the same WCF, or web service, they are treated as different. So creating an AssemblyA.Type and passing it to AssemblyB.Method wont work, as the Types are different. (no they are not). What if I could reference both Assemblies and interchange the two Types as if they were the same. Mark it as the same, and the CLR creates an adaptor/proxy for you.

Now if you have a system, and I have a system, both with a Person object, and happily coincidence it looks exactly the same. Albeit different assemblies, differently signed, it effectively could be the same thing, if only our tools allowed it. So what about being able to explicitly mark the two types so that it can be treated the same. A Wrapper within the CLR

yes we can code this manually
But it is not magically done, and that would save a lots of time. Take how .NET generates COM wrappers. Would you want to write it yourself?

In fact, add Duck Typing to this, method mapping, as explicit choices, a developer can make.
Mark the fact, declare that "treat these two classes as the same". Is this not in effect dynamic partial classes vs the traditional static partial class syntax we have now?

Read: A Tale of Two Types

Topic: Silverlight 2, Smooth Streaming, IIS 7, PlayReady und Moonlight 1.0 Previous Topic   Next Topic Topic: Innovation Award 2009 - Microsoft Österreich

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use