Proxy vs. Stub

I

IchBin

Dal said:
What is the difference between a proxy and a stub?
stub

A routine that doesn't actually do anything other than declare itself
and the parameters it accepts. Stubs are used commonly as placeholders
for routines that still need to be developed. The stub contains just
enough code to allow it to be compiled and linked with the rest of the
program.

proxy

A server that sits between a client application, such as a Web browser,
and a real server. It intercepts all requests to the real server to see
if it can fulfill the requests itself. If not, it forwards the request
to the real server.

Proxy servers have two main purposes:
# Improve Performance: Proxy servers can dramatically improve
performance for groups of users. This is because it saves the results of
all requests for a certain amount of time. Consider the case where both
user X and user Y access the World Wide Web through a proxy server.
First user X requests a certain Web page, which we'll call Page 1.
Sometime later, user Y requests the same page. Instead of forwarding the
request to the Web server where Page 1 resides, which can be a
time-consuming operation, the proxy server simply returns the Page 1
that it already fetched for user X. Since the proxy server is often on
the same network as the user, this is a much faster operation. Real
proxy servers support hundreds or thousands of users. The major online
services such as Compuserve and America Online, for example, employ an
array of proxy servers.
# Filter Requests: Proxy servers can also be used to filter requests.
For example, a company might use a proxy server to prevent its employees
from accessing a specific set of Web sites.

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
__________________________________________________________________________

' If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
D

Dal Mon

Thanks for the response. Stub and Proxy are terms that are overloaded
and mean many different things depending on context.

I was thinking along the lines of distributed programming. It seems
that in distributed programming, the terms stub and proxy seem to be
used interchangeably. I was wondering if my basic understanding of
these terms is somehow lacking or if they in fact refer to the same
thing.
 
B

Bjorn Abelli

...
Thanks for the response. Stub and Proxy are terms that are overloaded
and mean many different things depending on context.

I was thinking along the lines of distributed programming. It seems
that in distributed programming, the terms stub and proxy seem to be
used interchangeably. I was wondering if my basic understanding of
these terms is somehow lacking or if they in fact refer to the same
thing.

Even in distributed programming, those terms can mean different things
depending on the context... ;-)

Anyway, when in doubt I usually make use of a thesaurus, where the etymology
of the words can give more insight.

proxy: (person with) authority or power to act for another

Hence in distributed programming, this usually means a mechanism that
recieves the function calls "as if" it was the real distributed object, and
hence makes the call transparent to the calling object.

stub: a short blunt part left after a larger part has been
broken off or used up; something cut short or stunted

Hence in distributed programming, a stub is an *end-part* of the whole
chain, but has to be "glued" together with, or make use of, other pieces to
make the whole chain work.

In distributed programming in Java the stub in most cases is an interface,
or an abstract class, which is seen by the calling object as the "front-end"
to the "proxy mechanism".

So in my vocabulary, there's a difference between the two terms.

Just my 2c

// Bjorn A
 
D

Dal Mon

Ok, I decompiled the classes auto-generated by IBM for a web services
client. It looks like the class labelled as stub does the actual
remote call, while the class labelled as proxy acts as a wrapper around
the stub.

The curious thing is that they both implement the same interface, so a
client can call either the stub class or the proxy class. I suspect
that for this case, the proxy class is simply a convenience class
hiding the complexity of a lookup for the stub.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top