In cerl2 Series 5: SDL and my thoughts on network protocols, although I have introduced the ins and outs of SDL, I found that very important content is missing. My friends may ask, isn't SDL a common IDL (Interface Description Language)? Why not simply stick to a ready-made standard?
Many times, similar things seem like God or not. It is because I think IDL does not conform to my opinion on the network interface protocol that SDL is available.
First, most IDL are object-oriented. However, I think network protocols should be data-oriented. Why Is Object-Oriented in network protocols bad?
The reason is simple. Object-oriented network protocols will inevitably increase the complexity of implementation. Because we can pass objects in the network stream, naturally, the objects need to have a stub on the server and a proxy on the client ). What is particularly annoying is object lifecycle management. These make it difficult for the server and client to implement. If the complexity of the server is increased, the difficulty of the client is increased, which makes inter-language protocol calls more difficult.
The Data Stream-oriented network protocol is intuitive, eliminating all the burden of object-oriented. We have a very clear concept of the data transmitted in the network. After a simple understanding of the protocol details, you can quickly make a client call code in a new language without any foundation.
Simple is beautiful. This is the charm of data stream-oriented network protocols.
Another simple aspect of SDL is the description of SDL interfaces. For such a statement:
[ID = 2] Get (string key)-> {OK, string Val} | false;
You can see that "->" indicates the request package before the symbol, "->" indicates the response package. This is very intuitive. You can compare the following statement:
[ID = 2] bool get ([in] string key, [out] string * val );
The reading experience of both is not in the same grade.
In particular, when there are many response branches, the second method of description will be terrible.
Therefore, SDL is the best interface for describing network protocols from various perspectives.