(I'm not going to respond to the SQL stuff - I think you know I already
broadly agree, and you know I was just playing devil's advocate in order
to draw the analogy.)


Frans Bouma wrote:
> I see where you're heading to, that advising webservices
> as bad is wrong. :)

Not quite.  I'm saying that it's wrong to advise that webservices are
*always* bad.  Sometimes they're bad.  Sometimes they're not.

All of the points you bring up against them are valid in many scenarios.
I just don't think they are valid in *all* scenarios.  The only thing
I'm disagreeing with here is your original claim that web services are
always the wrong way to connect two .NET systems together.

I think they are often, but not always the wrong way.  Sometimes they
are they right way.
 

> However because webservices use xml to communicate, it has
> limitations, remoting doesn't have.

Agreed.  However, it's also true that because remoting uses the .NET
type system as the basis for its communications, it has some limitations
that web services don't have.  There are two limitations, one of which
you have mentioned yourself - remoting isn't viable for cross platform
work.  It's the other limitation you seem to be ignoring, or are unaware
of: sharing types makes it hard for systems to evolve independently.
With .NET remoting you're always sharing some types, even if you've
narrowed it down to a set of interfaces.

With web services, it is entirely unnecessary to share type information.
(And that's a point you appear not to have understood.  I get the
impression that you believe that the XML in web services is there as a
serialization format to represent some objects.  Thinking about XML that
way throws away all the benefits XML can offer you here.  If that *is*
how you think about it, then I'm not surprised you can't see any
advantage to XML...  But it's not a good way to think of it - it's
unnecessarily focused on sharing of programming types, which, for
reasons I'm about to explain, can sometimes be a bad thing.)


> You don't know how many times I get questions about people who
> want to use the rich objects of my O/R mapper in a webservice
> scenario.

Suppose you use remoting to enable this scenario.  For the first release
of the system, everything looks great.  But what happens when a new
release of your rich ORM objects becomes available?  (I'm assuming it's
a technology that you are actively supporting, so there will,
inevitably, be updates with enhancements, and bug fixes.)

If I, as the author of the server, want to upgrade to your latest and
greatest set of ORM tools, what happens to the client software?  They're
still using the old versions of the ORM tools.  So I can't upgrade on
the server without also simultaneously upgrading the client software.
If I don't do this, we're going find everything stops working - my
server will send the ORM objects across the wire, and the client will
look at the assembly name that remoting embeds in the streams, and will
notice that the version number doesn't match the version of the
locally-installed assembly, and will fail with an error.

At best, I'm going to have to push new versions of the ORM stuff out to
the client machines, and of course use some config files or publisher
policy to make sure that the client actually uses these new versions.
But if there are breaking changes, the client might need further
development work before it's able to run with the new ORM classes.

So although for your first release, everything was just great, the price
you pay turns out to be that the client and server must be updated at
the same time.  (Or, more succinctly, you have a high degree of
coupling.)

And sometimes that's OK.  But only sometimes.  You described a scenario
where you have two rack mounted servers in the same rack that need to
talk to each other.  In that particular case, it might not be a problem
to update both simultaneously.

But consider the case where there isn't just one client, but instead
there are 1000 desktop machines.  The cost of synchronizing your updates
just became more significant.  Of course things like the AppUpdater and
href deployment make this easier than it used to be.  But there's yet
another scenario where this doesn't help so much:

What if my service turned out to be really useful, and there are 15
different applications throughout the company all using it?  Now, when
the new release of your ORM toolkit (or whatever types it is that I'm
sharing) comes out, not only do I need to synchronize the release of
*15* different applications (possibly deployed on thousands of
machines), I actually need to have those 15 updates ready.  My
server-side change might be all ready to go, but I can't roll it out
until all 15 client applications have suitable updates available.  And
even in the simple 'no recompile necessary' case where we just need to
push new DLLs and a suitable config file, this has become a non-trivial
effort - someone needs to do the necessary regression testing to make
sure that these updates are going to work.

If only I had chosen a remoting solution that didn't rely on both ends
of the connection sharing type information, I wouldn't be in this mess -
I could update the server as often as necessary without incurring all
this extra cost.


What it boils down to is not really XML vs anything else.  It's about
tight coupling vs. loose coupling.  The thing you're complaining about -
the inability of web services to pass around arbitrary graphs of objects
of arbitrary types - turns out to work to your advantage here.  You are
prevented from doing all those things which are going to come back and
bite you when you need to update the server.  The lack of sharing of
types is a positive feature *if* you need to be able to update the
server independently of the client.  (If you don't need to do that, then
yes, it's a cumbersome restriction, and you should use .NET remoting
instead.) 

The XMLness is, strictly speaking, irrelevant to getting this
decoupling.  You could theoretically get all this loose coupling with a
binary protocol too.  But .NET remoting is not that protocol - it
positively embraces tight coupling.  (And for many scenarios that's a
good thing.  Just not for *all* scenarios.)  But the only thing built
into the .NET framework that offers this degree of decoupling is the web
services infrastructure.

So all I'm saying is that there's a tradeoff.  You have to ask what's
more valuable to you: the richness and performance of .NET remoting, or
the loose coupling offered by web services?  (Or, (3) write your own
binary protocol...)

You say that you need to understand the limitations of web services
before using them.  I agree.  But I also think the same is true of .NET
remoting.  Its limitations are often even less obvious than web
services, because you can go through a complete release cycle without
hitting them.  If you don't go in with your eyes open, you only discover
the potentially severe consequences of using .NET remoting mid way into
the next release cycle, when it's far too late to change your mind.


-- 
Ian Griffiths - DevelopMentor
(RSS: http://www.interact-sw.co.uk/iangblog/ )

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to