Stop using REST for state synchronization

2 pointsposted 12 hours ago
by mbid

1 Comments

FrankWilhoit

11 hours ago

The distinction between transfer and synchronization is right and important. But two problems remain.

The first is that the requirement for synchronization is an architecture smell, and a really bad one. It means that two or more actors have the same responsibilities. It creates incentives to overload types, and type overloading is the ultimate antipattern.

The second is that what is needed is state evolution, where each step of evolution grants access to a new role and revokes the access of a previous role.

Inheritance is the solution to both of these problems: each step inherits from the step before, and each new derived type is visible only to its own roles.

But while an object is in flight, it has only one (self-describing) type: the state is transferred, and the behavior is what is done to it by the recipient: tantamount to running the constructor of the derived type.