The Galactic Patrol

Thursday, February 10, 2005

[ServiceOperation]? Where's the message?

When you look at a simple Indigo "Hello, World" sample, you'll see that it follows the RPC style; the client constructs a proxy that implements an interface, it calls methods, magic happens on the wire, and the equivalent methods get called on your service object. The SOAP message purists are, I imagine, crying out: "but where is the message!?"

Well, the message is there; but over the past few years of evolving Indigo, and getting feedback on it, we've found that when using a language like C# that has objects and methods as its native constructs, the easiest, most accessible way of exposing our distributed services is via (you guessed it) objects and methods. However, the message is there if you want it:

[ServiceContract]
class Sample
{
[OperationContract]
public string Hello(string name)
{
Console.WriteLine(OperationContext.Current.IncomingMessage.ToString());
return "Hello, " + name;
}
}


If you want to be even more explicit, Indigo also supports a programming model something like this:

public string Hello(Message m) {...}


Perhaps I'll go into this in more detail in the future, as well as some other alternatives Indigo offers in the continuum of APIs between RPC and strict message-passing; let me know if that would be interesting.

12 Comments:

  • Well, that is exactly what sucks most about Indigo. You guys still seem to believe that messaging is only for purists and bitheads. Apparently the rest of are just too stupid to understand messaging and therefore you need to hide all those ugly details from us. If you guys spent half the time that you spend on building OO goo on top of messaging on building decent messaging interfaces you would discover that there is huge pentup demand for good messaging tools.

    By Anonymous Anonymous, at 5:41 AM, February 11, 2005  

  • Such vitriol! Hey, if you really want to deal with the "ugly details", Indigo makes that pretty easy too:

    IOutputChannel.Send(Message m)
    Message m = IInputChannel.Receive()

    Its even better than that, though; it just so happens that we are going to be releasing some interim Indigo drops soon for people to try out - we would *love* to have you try it out and give us constructive feedback about how Indigo can be improved.

    By Blogger Bruce, at 8:57 AM, February 11, 2005  

  • Actually, it's:

    OperationContext.Current.IncomingMessage.ToString()

    :)

    By Anonymous Steve, at 7:55 PM, February 11, 2005  

  • Thanks Steve! I fixed it.

    By Blogger Bruce, at 10:17 PM, February 11, 2005  

  • Bruce,

    I'll try to make my point without the vitriol. Imagine, if you will, an alternative world in which Microsoft took the following approach with the CLR. Instead of developing high-level languages that target the CLR, Microsoft decided that since developers were accustomed to creating COM objects using VB 6 and C++, unmanaged COM would be the primary high-level interface to the CLR. Microsoft would build a COM interop layer that would, at runtime, translate COM calls to IL to be executed by the CLR. To directly target this new execution environment, a developer could always write IL. There would an implicit assumption that only developers like, say, Brent Rector, would want to fully understand the "ugly details" of the new programming model.

    What I see from the Indigo team is a brilliant underlying messaging technology with a low-level messaging API and a high-level OO interop layer. The assumption by Microsoft seems to be that the only developers who want to work with messages as messages are the Tim Ewalds of the world. My position is that there are millions of corporate IT developers (who mostly program in Visual Basic and COBOL) whose work is best modeled by services and messages/documents. We don't want to muck around in the angle brackets. We do want technology that allows us to model core business concepts (purchase orders, service requests, etc.) effectively. We would be best served by a high-level messaging API that allows us write services that directly manipulate strongly-typed messages. The core Indigo constructs map fairly directly onto core business concepts. Instead of hiding the translation from the wire-format message to CLR type behind attribute-driven OO constructs, give us tools that allow us to design message types as independent entities and associate those messages with services which host our business logic.

    Constructively,

    John Cavnar-Johnson

    By Anonymous Anonymous, at 9:55 AM, February 12, 2005  

  • I'm trying to visualize what exactly your request would actually look like. Do you want ways to see the actual XML contents of the message body? Better ways to visualize the code <-> XSD/WSDL/Policy <-> XML relationships? What better ways would be good? I'm a visual guy - its too bad you can't post sketches of what you're thinking in comments.

    Showing the XML projection of the message body might not be too hard; message headers are more problematic, since the contents of the headers can come from code, config, from some incoming message, or who knows where.

    Your alternate world is interesting, but I don't imagine its going to happen at this point; sorry.

    By Blogger Bruce, at 11:06 AM, February 12, 2005  

  • First, my alternative world was intended to be a "Twilight Zone" nightmare. I assumed, perhaps naively, that that was obvious. Let's come at this in a slightly different manner. If you read Don Box's most recent post [1], he says something very interesting:

    Indigo allows service contracts to be expressed either in an XML format (specifically WSDL/1.1) or as annotated CLR interfaces. In reality, neither of these formats is the "native" contract format. Rather, we shred both formats into a simple in-memory tree structure that captures the "essence" of the contract.


    I want nothing more or less than a tool that will let me design that structure directly. I care nothing for either angle brackets or square brackets. That simple tree structure maps directly to the way I model my applications. But you guys have locked it away behind all those brackets. Now, there are glimmers of hope. The programming model described by Don's ContractThree is part of what I'm after:


    UserDataMessage msg = new UserDataMessage();
    msg.UserID = 4252;
    msg.NotifyOtherUsers = true;
    msg.Justification = "This user is a troll."

    channel.ProcessInsertMessage(msg);
    Of course, how anyone besides Don Box could intuit that model from the attribute-laden interface he describes is beyond me. I refuse to quote it here, it is really too hideous look upon. I suppose I'm looking for a DSL that will let me graphically design both services and messages while handling all the brackets, both square and angle, behind the scenes.

    I hope that's a little clearer.

    John Cavnar-Johnson


    [1] http://pluralsight.com/blogs/dbox/archive/2005/02/12/5819.aspx

    By Anonymous Anonymous, at 9:34 PM, February 12, 2005  

  • I get you - that makes complete sense to me. When I read that, my first thought was "wow, he's describing Whitehorse":

    http://msdn.microsoft.com/msdnmag/issues/04/07/whitehorse/default.aspx

    So maybe that is the answer to your desires.

    We did get some good feedback from earlier revs of Indigo that we showed off to a few people, feedback that we really should focus on providing good GUI dev tools. One part of that is working closely with the dev tools team - ie, Visual Studio including Whitehorse. You can be sure we do that. Do you want other non-VS-integrated tools for doing this? I'm sure we (that part of 'we' that makes marketing decisions) want you to pay us some bucks for the power Whitehorse gives you; but on the other hand we (the Indigo team that loves our customers) want to make it as easy as possible for as many people as possible to use Indigo; perhaps there is room for some simpler GUI tools that still provide the contract-construction abilities you are looking for.

    (caveat: I'm not on the tools sub-team of Indigo, so I can in no way even imply what work they may or may not be able to do before RTM.)

    By Blogger Bruce, at 11:48 PM, February 13, 2005  

  • Bruce,

    This post[1] by Clemens Vaster really clarified for me what I think is wrong with the Indigo programing model. He asks which style is better and I think they are both hideous. Am I the only person in the entire world that wants to be able to define my messages directly, without the whole OO + attributes crap? Why can't we define a message more like we would define an interface, like this:

    message Address
    {
    string Company;
    string RecipientName;
    string AddressLine1;

    ... the rest of the message members ...

    }

    public, private, data member, none of that crap has anything to do with the message. If you want a class to manipulate a message, you should declare that at the class level, just like you declare that a class implements an interface. The attribute-based approach assumes that the class comes first and the message is an afterthought. I want to define my message first and then decide how to process it.

    John Cavnar-Johnson



    [1] http://staff.newtelligence.net/clemensv/PermaLink,guid,b626e534-a167-415c-93d5-c4719e8fb6d2.aspx

    By Anonymous Anonymous, at 4:54 PM, March 01, 2005  

  • This post has been removed by a blog administrator.

    By Blogger oyun27, at 1:59 PM, September 24, 2007  

  • This post has been removed by a blog administrator.

    By Blogger cicicocuk, at 4:24 PM, February 13, 2008  

  • This post has been removed by a blog administrator.

    By Anonymous savaş oyunları, at 2:27 PM, December 24, 2008  

Post a Comment

<< Home