1

I'm trying to understand what is the difference between remote and distributed objects. I know this might be a simple concept and I'm probably too dumb to understand but can someone explain in layman's terms what they are or a very simple programming example(does remote mean local or private variables?, Is it similar to making something serializable?) or even better if they can provide an analogy (if any). Thank you so much!

ShippyDippy
  • 63
  • 10
  • 1
    "Remote" to me means it exists on a physically separate system (a different computer). A client and a server are both "remote" to each other, and two servers balancing a load are "remote" too. "Distributed" is one way of balancing a large computational load and is a specific type of "remote" systems. In Java we often need to make objects serializable so that they can be transferred between remote systems, but that not the only way (c.f. ProtoBuf for example). – markspace Mar 30 '21 at 18:59
  • @markspace So does that mean Remote is the same as Serializable but just for RMI? – ShippyDippy Mar 30 '21 at 19:03
  • 1
    No, there are other reasons to make an object Serializable. They are not the same. There is overlap, but also a lot that does not overlap. RMI is one specific way of implementing a remote call, but nowadays I'd say that things like REST are much more popular. – markspace Mar 30 '21 at 19:05
  • It depends on who's doing the talking. Most of the time I would say they mean the same thing. The Sun papers refer to remote and distributed objects indisciminately. – user207421 Apr 01 '21 at 01:03

1 Answers1

1

Same thing.

Object-oriented programming (OOP) defines a paradigm where objects message one another (or invoke methods on one another, whichever way you want to define it).

Distributed objects means technology that gives the objects the freedom to live in separate spaces, able to message one another across processes or even across machines. To quote Wikipedia:

Distributed objects … are distributed across different address spaces, either in different processes on the same computer, or even in multiple computers connected via a network, but which work together by sharing data and invoking methods.

The goal of distributed objects is to let them interoperate in the same manner whether living together in one process on one machine, or whether living separately. See also, Remote object communication on Wikipedia. Java provides a Java-centric distributed objects technology called Java Remote Method Invocation (RMI); see Wikipedia. CORBA is similar, a standardized approach to distributed objects that works across programming languages and platforms, in contrast to RMI being Java-specific.

The word “remote” in this context would merely emphasize or clarify that a particular object is not on the same machine, so access requires network access. And network access means slower speeds, more latency, and higher risk of failure.

You asked:

does remote mean local or private variables?,

No, totally different.

  • Local or private variables is about variable scope.
  • Regarding distributed objects and networking, local and remote refers to being on the same machine versus being on different machines and needing the network to communicate.

Unfortunately, the information technology industry frequently recycles words, using the same words in different ways for different meanings. Context is everything.

You asked:

Is it similar to making something serializable?) or

Serialization as a general term is about writing the data stored within an object (its “state”) to some external format (binary or textual) that can be consumed by other software at some other place or time. Such communication of state is needed when sending an object as the message between distributed objects.

Java Serialization is the name of a specific technology implementation and format for serializing Java objects. The purpose might for communication between distributed objects, but not necessarily. You could also use Java Serialization as a way of writing back-ups to disk, as one example.

Java Serialization is used in some technologies for communicating between distributed objects. But there are other ways to communicate the state of an object.

Be aware that Java Serialization has some serious security implications, FYI, and may be considered harmful where used in untrusted scenarios.

You asked:

even better if they can provide an analogy (if any)

I can give you an example. Suppose you build and deploy a system for your company that handles order fulfillment and logistics. Your system has modules, one module for invoicing, and one module for shipping.

Eventually your system grows to the point of burdening your server hardware. And your shipping info module has grown in sophistication to the point that you want to leverage it for use with other systems, and/or provide your customers with access to it.

So you decide to break out the shipping module to run on its own, on a separate machine in a different part of your network. But you want to maintain the same paradigm of object calls between your original invoicing system and your now-separate shipping system. So you decide to use RMI to hook the two systems together in a way that works the same as when they lived together in the same space. Very little of your original code need be changed.


Distributed objects have been declining in popularity, as Web Services technologies have met some of the same needs. However, distributed objects technologies solved decades ago some problems (security, discovery, and more) that were later encountered by the Web Services world, with solutions being reinvented all over again. So distributed objects are still viable in some scenarios, and should not be dismissed out of hand.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • Thanks a lot! Regarding the question about if remote means local/private variables, I did not mean literally but similar in terms of concept for example, a class cannot access the private variables of another class so I'm wondering if remote objects are similar in the sense, another machine B cannot access the object that is remote to machine A. – ShippyDippy Mar 30 '21 at 22:49
  • @ShippyDippy You must jump through efforts to publish access to an object to have it participate in a distributed objects scheme. By default, none of the objects in your JVM are reachable from outside that JVM. – Basil Bourque Mar 30 '21 at 23:36