The Artima Developer Community
Sponsored Link

News & Ideas Forum (Closed for new topic posts)
HTTP Needs Replacing

8 replies on 1 page. Most recent reply: Mar 20, 2002 3:08 AM by Jakob Eg Larsen

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 8 replies on 1 page
Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

HTTP Needs Replacing Posted: Mar 14, 2002 10:35 PM
Reply to this message Reply
Advertisement
"We have to do something to make it (HTTP) less important," said [Don] Box. "If we rely on HTTP we will melt the Internet. We at least have to raise the level of abstraction, so that we have an industry-wide way to do long-running requests -- I need a way to send a request to a server and not get the result for five days," says this ZDNet article:

http://news.zdnet.co.uk/story/0,,t269-s2105076,00.html


Jakob Eg Larsen

Posts: 18
Nickname: jlarsen
Registered: Jan, 2002

Re: HTTP Needs Replacing Posted: Mar 17, 2002 1:06 PM
Reply to this message Reply
> "We have to do something to make it (HTTP) less
> important," said [Don] Box. "If we rely on HTTP we
> will melt the Internet. We at least have to raise the
> level of abstraction, so that we have an
> industry-wide way to do long-running requests -- I
> need a way to send a request to a server and not get
> the result for five days,"

There has been a long discussion about this and related issues at the dist-obj mailinglist at distributedcoalition.org

See http://www.distributedcoalition.org/mailing_lists/dist-obj/msg03290.html

Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: HTTP Needs Replacing Posted: Mar 17, 2002 4:49 PM
Reply to this message Reply
One thing that popped into my head when I read "We at least have to raise the level of abstraction...", being the Jini-oriented guy I am, was that one way to raise the level of abstraction is to use interfaces, not protocols, as the nexus of communication between clients and services.

Protocols still need to be defined, of course, but they need not be standardized if you come up with a standardized set of interfaces for the kind of slow conversations Don Box is talking about.

Jakob Eg Larsen

Posts: 18
Nickname: jlarsen
Registered: Jan, 2002

Re: HTTP Needs Replacing Posted: Mar 18, 2002 1:56 AM
Reply to this message Reply
I gave a talk about Jini and ServiceUI last week for a Java knowledgeable audience, where I also stressed this unique feature of Jini -- The End of Protocols http://developer.java.sun.com/developer/technicalArticles/jini/protocols.html

Their reaction was that Jini just moves the problem from "define the protocol" to "define the interface". However, as you also point out, I believe it's a matter of different levels of abstraction.

Jakob Eg Larsen

Posts: 18
Nickname: jlarsen
Registered: Jan, 2002

Re: HTTP Needs Replacing Posted: Mar 18, 2002 3:22 AM
Reply to this message Reply
This was also said very precisely by Ken Arnold on JINI-USERS:

"The difference is most fundamentally in the level of agreement between client and service. In other systems that agreement is on the bits that are transmitted on the wire. In Jini the agreement is on the programming API the client will use -- the service provides an implementation of the API to the client. The result is that in traditional systems you embed decisions in the wire protocol in all participants. So if the wire protocol is designed to work well in a LAN, but you need to use a WAN you are just screwed. But in a Jini system that can be a matter of each system's API."

http://swjscmail1.java.sun.com/cgi-bin/wa?A2=ind0203&L=JINI-USERS&P=R9017

Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: HTTP Needs Replacing Posted: Mar 18, 2002 8:47 AM
Reply to this message Reply
> Their reaction was that Jini just moves the problem
> from "define the protocol" to "define the interface".
> However, as you also point out, I believe it's a
> matter of different levels of abstraction.

Yes, the difference involves abstraction. I've thought a lot about what that really means. At first I thought that we can be more abstract when talking about behavior than when talking about data. But that's not really true. I can be abstract when designing data too -- the more detail I leave out, the more abstract I'm being.

For example, I can define an XML DTD for a "dog" document in any number of ways. One real simple way is to just have one attribute that indicates the breed of dog. Or I could include the breed and color. Or I could include the breed, color, and weight, and age. Each of these dog DTDs is less abstract than the previous, because I'm giving progressively more information.

Imagine there's a dog service somewhere on the network. If the client/service contract for the dog service is a protocol, then that protocol probably includes a way to request a dog document and defines the data structure of that doc document. I can then write a client that requests a dog document, then using the information in the document, draws the retrieved dog on the screen for the user.

If, on the other hand, the client/service contract for the dog service is an API, then that API probably has an interface Dog and some set of methods, one of which could be void paint(Graphics g). I could then write a client that gets ahold of a Dog service proxy, and invoke its paint method passing in a graphics context. In this case I delegate the job of rendering the image of the dog onto the screen to the Dog object.

The difference in flexibility between these two approaches isn't that the behavior-oriented contract of paint is inherently more abstract than any data-oriented dog contract. A dog DTD that specifies only the breed is pretty darn abstract. The difference in flexibility comes about because to do something different in the dog drawing code, you often need different dog data.

So for example, assume version 1.0 of these two flavors (protocol and API) of dog service just send the breed of the dog. So any cocker spaniel ends up looking like every other cocker spaniel when rendered on the screen. In version 1.1beta2-3x12 of the dog services, however, the desire is to also render the dog in an appropriate color. Well, to change the code, you need more information. You need to know the dog color.

In the protocol version, you must add color to the DTD. This DTD change will either break existing clients, or if the clients were written to ignore fields that aren't understood, it will not break the client, but then the color field isn't used when those old clients render on the screen.

In the API version, the author of the service proxy can add color as a private field in the Dog service proxy, and can change the code of paint so that it uses that information. This breaks no client, and every client that was invoking paint sees all dogs rendered with appropriate colors.

Now all this is nothing more than an illustration of the kind of flexibility benefit you get with object-oriented programming. An important idea in OO is delegation -- in design you try to delegate responsibility for behavior to objects that have the data required by that behavior. So in the case of dogs, you delegate to Dog objects the responsibility for painting the dog on a graphics context, because that painting requires dog data.

What Jini does is allow programmers of distributed systems to get at that general benefit of OO in their distributed systems. One of my Jiniology articles did a more elaborate comparison and contrast between protocols and APIs:

http://www.artima.com/jini/jiniology/objdoc1.html

I talk a bit more about abstraction and flexibility in this follow up article:

http://www.artima.com/jini/jiniology/objdoc2P.html

Jakob Eg Larsen

Posts: 18
Nickname: jlarsen
Registered: Jan, 2002

Re: HTTP Needs Replacing Posted: Mar 19, 2002 7:01 AM
Reply to this message Reply
The Dog example clearly illustrates the flexibility and benefit of object-oriented programming, and the interface approach over the protocol approach. However, I am still curious whether the OO approach avoids the issue of embedding decisions in the interface. An Interface (for instance for a Jini service) with a method such as

Vector getItems() throws RemoteException;

might work fine under a given set of assumptions. E.g. the receiver has plenty of memory and CPU power, the communication is over a LAN, et cetera so receiving a "large" vector of items is no problem. However, if the receiver has resource constraints and the communication runs on a loosely coupled network it might be a different story. In that case the interface (method) should probably be changed to return an iterator. This allows the receiver to iterate over the items and receive them in smaller chunks if needed due to network or other resource constraints.

Of course the quality of the design as such is always debatable, but it seems to me that we might be operating in a much larger design space. Thus to avoid embedding of undesirable desisions into the interface might be non-trivial as well. Also to consider what people might do with the interface or in which context they use it in the future is also non-trivial to cover at design time.

Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: HTTP Needs Replacing Posted: Mar 19, 2002 9:43 AM
Reply to this message Reply
Jakob,

Well, design is always hard, and I don't think using APIs instead of protocols makes the design process any easier. Using APIs just allows designers to come up with designs that are better at adapting to change. (Note it allows designers to do that, doesn't force them to do that. People being hunan will always make mistakes in designs that they later regret. I, for example. wish we had marshalled the attibutes set in UIDescriptor in the serviceUI API. That would have been a better design, I now think, but it is too late to do that.)

As far as your specific example, bandwidth limitations and latency should definitely be considered in both a network protocol designs and Jini API designs. I think your point may be that API design doesn't let you abstract away the network completely, and I think that echoes one of the basic philosophical foundations behind Jini: because of limited bandwidth, nonzero latency, and partial failure, you can't make the network transparent. That's why RemoteException is a checked exception, because it encourages client programmers to deal with the possibility of failure on the network.

Some APIs may be designed for a very specific context in which expected bandwidth and latency are thought to be well understood, though whenever an API is designed for just an expected bandwidth/latency, that API will probably not adapt easily to changing bandwidth/latency circumstances in the future. Most often it will be best to assume you don't know what the bandwidth and latency will be.

I think that's the assumption we are making as we design the Place API, and I think we're doing OK. I think you see this network uncertainty show up in our API, for example, in the DistributedIterator class, which you, Berco Beute, Peter Kellner, and I whipped up during my vist to Copenhagen last summer. The idea is that a client is iterating over a collection that may be stored across the network. This iterator has a boolean hasNext() method and an Object next() method, but they have RemoteException in their throws clause. It also has Object next(int nextCache) that allows the client to actually get into the details of how many of upcoming elements to pull across the network in one chunk. This interface may change, of course, but you can see we are trying to deal with network uncertainties in our API Design. DistributedIterator is in the current Place API, the javadoc of which is here:

http://www.artima.com/jini/cyberspace/doc/index.html

One last thing, the first thing I'd say in a design review of a Vector getItems() throws RemoteException method is that it should probably return List, not Vector.

Jakob Eg Larsen

Posts: 18
Nickname: jlarsen
Registered: Jan, 2002

Re: HTTP Needs Replacing Posted: Mar 20, 2002 3:08 AM
Reply to this message Reply
> I think your point may be that API
> design doesn't let you abstract away the network
> completely, and I think that echoes one of the basic
> philosophical foundations behind Jini: because of
> limited bandwidth, nonzero latency, and partial
> failure, you can't make the network transparent.

Right, that was indeed the point I was trying to make. It is an important design challenge for both protocol and API designers.

> I think that's the assumption we are making as we
> design the Place API, and I think we're doing OK. I
> think you see this network uncertainty show up in our
> API, for example, in the DistributedIterator
> class, which you, Berco Beute, Peter Kellner, and I
> whipped up during my vist to Copenhagen last summer.

Our DistributedIterator interface was exactly what I had in mind when I came up with my example. I also believe we are doing the right thing by introducing the DistributedIterator in the Place API. We have to deal with it in a way where we take the network issues into account.

Maybe our DistributedIterator interface illustrates that some of the Java API's are actually designed with the undesirable assumption that they are going to be used in one JVM. Whereas the work we are doing with the Place API assumes that more JVM's are involved and thus we must take the network into account.

That's illustrated by our example where we could not use the java.util.Iterator interface, because the methods are not declared to throw RemoteException and we had to add caching as well -- the Object next(int cacheSize) method.

> This interface may change, of
> course, but you can see we are trying to deal with
> network uncertainties in our API Design.

Yes, exactly. I believe that probably some of the other standard Java interfaces might need to have distributed and network-aware counterparts as well.

Flat View: This topic has 8 replies on 1 page
Topic: Artima Forums Get a New Look Previous Topic   Next Topic Topic: Sun Dreams of Jini for Web Services

Sponsored Links



Google
  Web Artima.com   

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