Postel’s Law or the Robustness Principle

Another important principle for the definition of interfaces is Postel’s Law,[1] which is also known as the Robustness Principle. It states that components should be strict with regard to what they are passing on and liberal with regard to what they are accepting from others. Put differently, each component should adhere as closely as possible to the defined interface when using other components but should, whenever possible, compensate for errors that arise during the use of its own interface.

When each component behaves according to the Robustness Principle interoperability will improve: in fact, if each component adheres exactly to the defined interfaces, interoperability should already be guaranteed. If a deviation does happen, then the component being used will try to compensate for it and thereby attempt to “save” the interoperability. This concept is also known as Tolerant Reader.[2]

In practice a called service should accept the calls as long as this is at all possible. One way to achieve this is to only read out those parameters from a call that are really necessary. On no account should a call be rejected just because it does not formally conform to the interface specification. However, the incoming calls should be validated. Such an approach makes it easier to ensure smooth communication in distributed systems like microservices.

  • [1] http://tools.ietf.org/html/rfc793#section-2.10
  • [2] http://martinfowler.com/bliki/TolerantReader.html
 
Source
< Prev   CONTENTS   Source   Next >