How are distributed services better than distributed objects?

I'm not interested in technology, for example. CORBA vs Web Services, I'm interested in principles. When we do OOP, why should we have something so procedural at a higher level? Isn't that the same as with OOP and relational databases? Often services are supported through code generation, in addition to the template, I think this is because we are the new SOM service object mapper. So what are the reasons for wervices and not objects?

+4
source share
5 answers

The main difference between the distribution of services and the distribution of objects is that services and their operations, by definition, are coarse-grained, and objects by default are fine-grained.

When making remote calls, network latency is a fact, and the rougher your interface is, the better. Service-oriented patterns and practices focus on building such interfaces.

So, to summarize, the problem is not in the technology or protocol (binary, but in XML), but rather in usage scenarios. You can create “services” in CORBA and program distributed old-school objects in WCF, but the former seems to be more biased towards objects, and the latter to services ...

+4
source

Distributed objects and remote procedure calls seem to be a shared state between processes, while services are self-contained.

It can be compared with the relationship between a regular OOP in a common state language and a language using the Actor model and without a common state (for example, in Erlang, where you have many easy processes that do not share anything, but only through messages). The Actor model approach is much less complex and can give you advantages over concurrency, etc.

+1
source

IMHO, at a high level there are few differences. But at the implementation level, distributed objects, CORBA, Java RMI, etc. Leave much to be desired. I tried to work with CORBA and then RMI on real production systems, and version synchronization was a nightmare.

These days I am sending messages and receiving replies.

0
source

Distributed object means what? Two copies of the same object that need to be synchronized? biphasic fixation for every change in an object? Complex.

Moving an object over a network from location to location? In this case, you must be sure that the "ownership" is correctly denied. How does one owner know that another has changed the state of an object? Should it be - what - copied back?

The distributed object model is quickly becoming complex.

A service — the simplest one — means that it is one host that offers the service and maintains the state. Relational databases have been demonstrating this service model for decades. Like other traditional services (i.e. Email, NIS, etc.)

With one service offering a host, there is no synchronization between copies, duplication and very limited complexity.

"why should we have something so procedural on a higher level"

You do not have something procedural on a higher level.

You have an object (a host that offers services) in several ways. It is ideally object oriented.

He is - in general - Singleton , which makes life very simple.

0
source

Why is this a contradiction? The concepts of distributed services and distributed objects overlap significantly, if not completely (and SOAP is the protocol for accessing objects, after all). WCF is one example of switching between a "web service" and a "remote object" using a single configuration line.

The difference is mainly terminological, due to historical areas of application.

(Shimon wrote essentially the same source)

0
source

Source: https://habr.com/ru/post/1306179/


All Articles